lex-agentic-memory 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +13 -0
- data/lex-agentic-memory.gemspec +30 -0
- data/lib/legion/extensions/agentic/memory/archaeology/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/archaeology/helpers/archaeology_engine.rb +184 -0
- data/lib/legion/extensions/agentic/memory/archaeology/helpers/artifact.rb +146 -0
- data/lib/legion/extensions/agentic/memory/archaeology/helpers/constants.rb +95 -0
- data/lib/legion/extensions/agentic/memory/archaeology/helpers/excavation_site.rb +97 -0
- data/lib/legion/extensions/agentic/memory/archaeology/runners/cognitive_archaeology.rb +86 -0
- data/lib/legion/extensions/agentic/memory/archaeology/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/archaeology.rb +22 -0
- data/lib/legion/extensions/agentic/memory/compression/client.rb +15 -0
- data/lib/legion/extensions/agentic/memory/compression/helpers/compression_engine.rb +145 -0
- data/lib/legion/extensions/agentic/memory/compression/helpers/constants.rb +44 -0
- data/lib/legion/extensions/agentic/memory/compression/helpers/information_chunk.rb +81 -0
- data/lib/legion/extensions/agentic/memory/compression/runners/cognitive_compression.rb +76 -0
- data/lib/legion/extensions/agentic/memory/compression/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/compression.rb +19 -0
- data/lib/legion/extensions/agentic/memory/echo/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/echo/helpers/constants.rb +57 -0
- data/lib/legion/extensions/agentic/memory/echo/helpers/echo.rb +95 -0
- data/lib/legion/extensions/agentic/memory/echo/helpers/echo_engine.rb +136 -0
- data/lib/legion/extensions/agentic/memory/echo/runners/cognitive_echo.rb +81 -0
- data/lib/legion/extensions/agentic/memory/echo/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/echo.rb +19 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/helpers/chamber.rb +134 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/helpers/chamber_engine.rb +156 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/helpers/constants.rb +60 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/helpers/echo.rb +96 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/runners/cognitive_echo_chamber.rb +84 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/echo_chamber.rb +21 -0
- data/lib/legion/extensions/agentic/memory/episodic/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/memory/episodic/client.rb +25 -0
- data/lib/legion/extensions/agentic/memory/episodic/helpers/constants.rb +36 -0
- data/lib/legion/extensions/agentic/memory/episodic/helpers/episode.rb +104 -0
- data/lib/legion/extensions/agentic/memory/episodic/helpers/episodic_binding.rb +57 -0
- data/lib/legion/extensions/agentic/memory/episodic/helpers/episodic_store.rb +141 -0
- data/lib/legion/extensions/agentic/memory/episodic/runners/episodic_buffer.rb +108 -0
- data/lib/legion/extensions/agentic/memory/episodic/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/episodic.rb +20 -0
- data/lib/legion/extensions/agentic/memory/hologram/client.rb +23 -0
- data/lib/legion/extensions/agentic/memory/hologram/helpers/constants.rb +67 -0
- data/lib/legion/extensions/agentic/memory/hologram/helpers/hologram.rb +118 -0
- data/lib/legion/extensions/agentic/memory/hologram/helpers/hologram_engine.rb +117 -0
- data/lib/legion/extensions/agentic/memory/hologram/helpers/holographic_fragment.rb +70 -0
- data/lib/legion/extensions/agentic/memory/hologram/runners/cognitive_hologram.rb +110 -0
- data/lib/legion/extensions/agentic/memory/hologram/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/hologram.rb +22 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/helpers/constants.rb +84 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb +54 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/helpers/immune_memory_engine.rb +171 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/helpers/memory_cell.rb +97 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/runners/cognitive_immune_memory.rb +76 -0
- data/lib/legion/extensions/agentic/memory/immune_memory/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/immune_memory.rb +20 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/client.rb +31 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/helpers/constants.rb +68 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_engine.rb +148 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event.rb +44 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/helpers/nostalgic_memory.rb +97 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/runners/analysis.rb +61 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/runners/recall.rb +60 -0
- data/lib/legion/extensions/agentic/memory/nostalgia/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/nostalgia.rb +21 -0
- data/lib/legion/extensions/agentic/memory/offloading/client.rb +29 -0
- data/lib/legion/extensions/agentic/memory/offloading/helpers/constants.rb +55 -0
- data/lib/legion/extensions/agentic/memory/offloading/helpers/external_store.rb +82 -0
- data/lib/legion/extensions/agentic/memory/offloading/helpers/offloaded_item.rb +65 -0
- data/lib/legion/extensions/agentic/memory/offloading/helpers/offloading_engine.rb +138 -0
- data/lib/legion/extensions/agentic/memory/offloading/runners/cognitive_offloading.rb +102 -0
- data/lib/legion/extensions/agentic/memory/offloading/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/offloading.rb +20 -0
- data/lib/legion/extensions/agentic/memory/paleontology/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/paleontology/helpers/constants.rb +69 -0
- data/lib/legion/extensions/agentic/memory/paleontology/helpers/excavation.rb +62 -0
- data/lib/legion/extensions/agentic/memory/paleontology/helpers/fossil.rb +125 -0
- data/lib/legion/extensions/agentic/memory/paleontology/helpers/paleontology_engine.rb +170 -0
- data/lib/legion/extensions/agentic/memory/paleontology/runners/cognitive_paleontology.rb +93 -0
- data/lib/legion/extensions/agentic/memory/paleontology/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/paleontology.rb +22 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/helpers/belief_layer.rb +81 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/helpers/constants.rb +56 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/helpers/palimpsest.rb +124 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/helpers/palimpsest_engine.rb +117 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/runners/cognitive_palimpsest.rb +105 -0
- data/lib/legion/extensions/agentic/memory/palimpsest/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/palimpsest.rb +21 -0
- data/lib/legion/extensions/agentic/memory/reserve/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/reserve/helpers/constants.rb +58 -0
- data/lib/legion/extensions/agentic/memory/reserve/helpers/pathway.rb +112 -0
- data/lib/legion/extensions/agentic/memory/reserve/helpers/reserve_engine.rb +163 -0
- data/lib/legion/extensions/agentic/memory/reserve/runners/cognitive_reserve.rb +92 -0
- data/lib/legion/extensions/agentic/memory/reserve/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/reserve.rb +19 -0
- data/lib/legion/extensions/agentic/memory/semantic/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/memory/semantic/client.rb +28 -0
- data/lib/legion/extensions/agentic/memory/semantic/helpers/concept.rb +101 -0
- data/lib/legion/extensions/agentic/memory/semantic/helpers/constants.rb +51 -0
- data/lib/legion/extensions/agentic/memory/semantic/helpers/knowledge_store.rb +145 -0
- data/lib/legion/extensions/agentic/memory/semantic/runners/semantic_memory.rb +94 -0
- data/lib/legion/extensions/agentic/memory/semantic/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/semantic.rb +20 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/client.rb +19 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/helpers/connection.rb +77 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/helpers/constants.rb +68 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/helpers/priming_network.rb +206 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/helpers/semantic_node.rb +81 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/runners/semantic_priming.rb +120 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/semantic_priming.rb +20 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation/client.rb +28 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation/helpers/concept.rb +82 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation/helpers/constants.rb +37 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation/helpers/satiation_engine.rb +103 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb +92 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/semantic_satiation.rb +19 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/actors/decay.rb +31 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/client.rb +28 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/helpers/constants.rb +66 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/helpers/source_record.rb +94 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/helpers/source_tracker.rb +119 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/runners/source_monitoring.rb +95 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/source_monitoring.rb +19 -0
- data/lib/legion/extensions/agentic/memory/trace/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/memory/trace/actors/tier_migration.rb +45 -0
- data/lib/legion/extensions/agentic/memory/trace/batch_decay.rb +44 -0
- data/lib/legion/extensions/agentic/memory/trace/client.rb +32 -0
- data/lib/legion/extensions/agentic/memory/trace/helpers/cache_store.rb +167 -0
- data/lib/legion/extensions/agentic/memory/trace/helpers/decay.rb +68 -0
- data/lib/legion/extensions/agentic/memory/trace/helpers/error_tracer.rb +94 -0
- data/lib/legion/extensions/agentic/memory/trace/helpers/store.rb +260 -0
- data/lib/legion/extensions/agentic/memory/trace/helpers/trace.rb +106 -0
- data/lib/legion/extensions/agentic/memory/trace/local_migrations/20260316000001_create_memory_traces.rb +31 -0
- data/lib/legion/extensions/agentic/memory/trace/local_migrations/20260316000002_create_memory_associations.rb +13 -0
- data/lib/legion/extensions/agentic/memory/trace/persistent_store.rb +94 -0
- data/lib/legion/extensions/agentic/memory/trace/quota.rb +55 -0
- data/lib/legion/extensions/agentic/memory/trace/runners/consolidation.rb +121 -0
- data/lib/legion/extensions/agentic/memory/trace/runners/traces.rb +105 -0
- data/lib/legion/extensions/agentic/memory/trace/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/trace.rb +54 -0
- data/lib/legion/extensions/agentic/memory/transfer/client.rb +28 -0
- data/lib/legion/extensions/agentic/memory/transfer/helpers/constants.rb +34 -0
- data/lib/legion/extensions/agentic/memory/transfer/helpers/domain_knowledge.rb +74 -0
- data/lib/legion/extensions/agentic/memory/transfer/helpers/transfer_engine.rb +188 -0
- data/lib/legion/extensions/agentic/memory/transfer/runners/transfer_learning.rb +77 -0
- data/lib/legion/extensions/agentic/memory/transfer/version.rb +13 -0
- data/lib/legion/extensions/agentic/memory/transfer.rb +19 -0
- data/lib/legion/extensions/agentic/memory/version.rb +11 -0
- data/lib/legion/extensions/agentic/memory.rb +35 -0
- data/spec/legion/extensions/agentic/memory/archaeology/client_spec.rb +38 -0
- data/spec/legion/extensions/agentic/memory/archaeology/cognitive_archaeology_spec.rb +7 -0
- data/spec/legion/extensions/agentic/memory/archaeology/helpers/archaeology_engine_spec.rb +165 -0
- data/spec/legion/extensions/agentic/memory/archaeology/helpers/artifact_spec.rb +196 -0
- data/spec/legion/extensions/agentic/memory/archaeology/helpers/constants_spec.rb +42 -0
- data/spec/legion/extensions/agentic/memory/archaeology/helpers/excavation_site_spec.rb +115 -0
- data/spec/legion/extensions/agentic/memory/archaeology/runners/cognitive_archaeology_spec.rb +96 -0
- data/spec/legion/extensions/agentic/memory/compression/helpers/compression_engine_spec.rb +138 -0
- data/spec/legion/extensions/agentic/memory/compression/helpers/constants_spec.rb +50 -0
- data/spec/legion/extensions/agentic/memory/compression/helpers/information_chunk_spec.rb +123 -0
- data/spec/legion/extensions/agentic/memory/compression/runners/cognitive_compression_spec.rb +80 -0
- data/spec/legion/extensions/agentic/memory/echo/client_spec.rb +20 -0
- data/spec/legion/extensions/agentic/memory/echo/cognitive_echo_spec.rb +7 -0
- data/spec/legion/extensions/agentic/memory/echo/helpers/echo_engine_spec.rb +152 -0
- data/spec/legion/extensions/agentic/memory/echo/helpers/echo_spec.rb +128 -0
- data/spec/legion/extensions/agentic/memory/echo/runners_spec.rb +80 -0
- data/spec/legion/extensions/agentic/memory/echo_chamber/client_spec.rb +84 -0
- data/spec/legion/extensions/agentic/memory/echo_chamber/helpers/chamber_engine_spec.rb +266 -0
- data/spec/legion/extensions/agentic/memory/echo_chamber/helpers/chamber_spec.rb +249 -0
- data/spec/legion/extensions/agentic/memory/echo_chamber/helpers/constants_spec.rb +130 -0
- data/spec/legion/extensions/agentic/memory/echo_chamber/helpers/echo_spec.rb +252 -0
- data/spec/legion/extensions/agentic/memory/echo_chamber/runners/cognitive_echo_chamber_spec.rb +185 -0
- data/spec/legion/extensions/agentic/memory/episodic/client_spec.rb +80 -0
- data/spec/legion/extensions/agentic/memory/episodic/episodic_buffer_spec.rb +15 -0
- data/spec/legion/extensions/agentic/memory/episodic/helpers/constants_spec.rb +86 -0
- data/spec/legion/extensions/agentic/memory/episodic/helpers/episode_spec.rb +188 -0
- data/spec/legion/extensions/agentic/memory/episodic/helpers/episodic_binding_spec.rb +114 -0
- data/spec/legion/extensions/agentic/memory/episodic/helpers/episodic_store_spec.rb +201 -0
- data/spec/legion/extensions/agentic/memory/episodic/runners/episodic_buffer_spec.rb +208 -0
- data/spec/legion/extensions/agentic/memory/hologram/client_spec.rb +89 -0
- data/spec/legion/extensions/agentic/memory/hologram/cognitive_hologram_spec.rb +39 -0
- data/spec/legion/extensions/agentic/memory/hologram/helpers/constants_spec.rb +143 -0
- data/spec/legion/extensions/agentic/memory/hologram/helpers/hologram_engine_spec.rb +268 -0
- data/spec/legion/extensions/agentic/memory/hologram/helpers/hologram_spec.rb +256 -0
- data/spec/legion/extensions/agentic/memory/hologram/helpers/holographic_fragment_spec.rb +213 -0
- data/spec/legion/extensions/agentic/memory/hologram/runners/cognitive_hologram_spec.rb +239 -0
- data/spec/legion/extensions/agentic/memory/immune_memory/client_spec.rb +18 -0
- data/spec/legion/extensions/agentic/memory/immune_memory/cognitive_immune_memory_spec.rb +7 -0
- data/spec/legion/extensions/agentic/memory/immune_memory/helpers/encounter_spec.rb +85 -0
- data/spec/legion/extensions/agentic/memory/immune_memory/helpers/immune_memory_engine_spec.rb +203 -0
- data/spec/legion/extensions/agentic/memory/immune_memory/helpers/memory_cell_spec.rb +190 -0
- data/spec/legion/extensions/agentic/memory/immune_memory/runners_spec.rb +83 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/client_spec.rb +71 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/helpers/constants_spec.rb +65 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_engine_spec.rb +191 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/helpers/nostalgia_event_spec.rb +59 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/helpers/nostalgic_memory_spec.rb +134 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/runners/analysis_spec.rb +97 -0
- data/spec/legion/extensions/agentic/memory/nostalgia/runners/recall_spec.rb +81 -0
- data/spec/legion/extensions/agentic/memory/offloading/client_spec.rb +30 -0
- data/spec/legion/extensions/agentic/memory/offloading/helpers/constants_spec.rb +71 -0
- data/spec/legion/extensions/agentic/memory/offloading/helpers/external_store_spec.rb +158 -0
- data/spec/legion/extensions/agentic/memory/offloading/helpers/offloaded_item_spec.rb +123 -0
- data/spec/legion/extensions/agentic/memory/offloading/helpers/offloading_engine_spec.rb +250 -0
- data/spec/legion/extensions/agentic/memory/offloading/runners/cognitive_offloading_spec.rb +194 -0
- data/spec/legion/extensions/agentic/memory/paleontology/client_spec.rb +27 -0
- data/spec/legion/extensions/agentic/memory/paleontology/cognitive_paleontology_spec.rb +7 -0
- data/spec/legion/extensions/agentic/memory/paleontology/helpers/constants_spec.rb +33 -0
- data/spec/legion/extensions/agentic/memory/paleontology/helpers/excavation_spec.rb +71 -0
- data/spec/legion/extensions/agentic/memory/paleontology/helpers/fossil_spec.rb +134 -0
- data/spec/legion/extensions/agentic/memory/paleontology/helpers/paleontology_engine_spec.rb +148 -0
- data/spec/legion/extensions/agentic/memory/paleontology/runners/cognitive_paleontology_spec.rb +89 -0
- data/spec/legion/extensions/agentic/memory/palimpsest/client_spec.rb +58 -0
- data/spec/legion/extensions/agentic/memory/palimpsest/helpers/belief_layer_spec.rb +150 -0
- data/spec/legion/extensions/agentic/memory/palimpsest/helpers/constants_spec.rb +63 -0
- data/spec/legion/extensions/agentic/memory/palimpsest/helpers/palimpsest_engine_spec.rb +164 -0
- data/spec/legion/extensions/agentic/memory/palimpsest/helpers/palimpsest_spec.rb +172 -0
- data/spec/legion/extensions/agentic/memory/palimpsest/runners/cognitive_palimpsest_spec.rb +165 -0
- data/spec/legion/extensions/agentic/memory/reserve/client_spec.rb +37 -0
- data/spec/legion/extensions/agentic/memory/reserve/helpers/pathway_spec.rb +165 -0
- data/spec/legion/extensions/agentic/memory/reserve/helpers/reserve_engine_spec.rb +196 -0
- data/spec/legion/extensions/agentic/memory/reserve/runners/cognitive_reserve_spec.rb +96 -0
- data/spec/legion/extensions/agentic/memory/semantic/client_spec.rb +35 -0
- data/spec/legion/extensions/agentic/memory/semantic/helpers/concept_spec.rb +119 -0
- data/spec/legion/extensions/agentic/memory/semantic/helpers/knowledge_store_spec.rb +140 -0
- data/spec/legion/extensions/agentic/memory/semantic/runners/semantic_memory_spec.rb +103 -0
- data/spec/legion/extensions/agentic/memory/semantic_priming/helpers/connection_spec.rb +98 -0
- data/spec/legion/extensions/agentic/memory/semantic_priming/helpers/priming_network_spec.rb +208 -0
- data/spec/legion/extensions/agentic/memory/semantic_priming/helpers/semantic_node_spec.rb +125 -0
- data/spec/legion/extensions/agentic/memory/semantic_priming/semantic_priming_spec.rb +7 -0
- data/spec/legion/extensions/agentic/memory/semantic_satiation/client_spec.rb +19 -0
- data/spec/legion/extensions/agentic/memory/semantic_satiation/helpers/concept_spec.rb +167 -0
- data/spec/legion/extensions/agentic/memory/semantic_satiation/helpers/constants_spec.rb +81 -0
- data/spec/legion/extensions/agentic/memory/semantic_satiation/helpers/satiation_engine_spec.rb +189 -0
- data/spec/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation_spec.rb +176 -0
- data/spec/legion/extensions/agentic/memory/source_monitoring/client_spec.rb +25 -0
- data/spec/legion/extensions/agentic/memory/source_monitoring/helpers/source_record_spec.rb +152 -0
- data/spec/legion/extensions/agentic/memory/source_monitoring/helpers/source_tracker_spec.rb +139 -0
- data/spec/legion/extensions/agentic/memory/source_monitoring/runners/source_monitoring_spec.rb +102 -0
- data/spec/legion/extensions/agentic/memory/trace/actors/decay_spec.rb +62 -0
- data/spec/legion/extensions/agentic/memory/trace/actors/tier_migration_spec.rb +62 -0
- data/spec/legion/extensions/agentic/memory/trace/batch_decay_spec.rb +26 -0
- data/spec/legion/extensions/agentic/memory/trace/client_spec.rb +62 -0
- data/spec/legion/extensions/agentic/memory/trace/helpers/decay_spec.rb +134 -0
- data/spec/legion/extensions/agentic/memory/trace/helpers/store_spec.rb +217 -0
- data/spec/legion/extensions/agentic/memory/trace/helpers/trace_spec.rb +120 -0
- data/spec/legion/extensions/agentic/memory/trace/local_persistence_spec.rb +255 -0
- data/spec/legion/extensions/agentic/memory/trace/memory_spec.rb +11 -0
- data/spec/legion/extensions/agentic/memory/trace/persistent_store_spec.rb +50 -0
- data/spec/legion/extensions/agentic/memory/trace/quota_spec.rb +56 -0
- data/spec/legion/extensions/agentic/memory/trace/runners/consolidation_spec.rb +118 -0
- data/spec/legion/extensions/agentic/memory/trace/runners/traces_spec.rb +69 -0
- data/spec/legion/extensions/agentic/memory/transfer/client_spec.rb +18 -0
- data/spec/legion/extensions/agentic/memory/transfer/helpers/constants_spec.rb +41 -0
- data/spec/legion/extensions/agentic/memory/transfer/helpers/domain_knowledge_spec.rb +134 -0
- data/spec/legion/extensions/agentic/memory/transfer/helpers/transfer_engine_spec.rb +299 -0
- data/spec/legion/extensions/agentic/memory/transfer/runners/transfer_learning_spec.rb +144 -0
- data/spec/spec_helper.rb +46 -0
- metadata +351 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEngine do
|
|
4
|
+
subject(:engine) { described_class.new }
|
|
5
|
+
|
|
6
|
+
let(:memory_attrs) do
|
|
7
|
+
{ content: 'childhood home', domain: :place, original_valence: 0.4 }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe '#create_memory' do
|
|
11
|
+
it 'creates and stores a NostalgicMemory' do
|
|
12
|
+
memory = engine.create_memory(**memory_attrs)
|
|
13
|
+
expect(memory).to be_a(Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgicMemory)
|
|
14
|
+
expect(engine.memories.size).to eq(1)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'returns memory with correct content' do
|
|
18
|
+
memory = engine.create_memory(**memory_attrs)
|
|
19
|
+
expect(memory.content).to eq('childhood home')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'enforces MAX_MEMORIES cap' do
|
|
23
|
+
(Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::Constants::MAX_MEMORIES + 5).times do |i|
|
|
24
|
+
engine.create_memory(content: "memory #{i}")
|
|
25
|
+
end
|
|
26
|
+
expect(engine.memories.size).to eq(Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::Constants::MAX_MEMORIES)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#trigger_nostalgia' do
|
|
31
|
+
before do
|
|
32
|
+
engine.create_memory(content: 'old friend from school', domain: :relationship,
|
|
33
|
+
warmth: 0.7, original_valence: 0.5)
|
|
34
|
+
engine.create_memory(content: 'school lunchroom', domain: :place,
|
|
35
|
+
warmth: 0.6, original_valence: 0.4)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context 'when memories match the trigger' do
|
|
39
|
+
it 'returns events for matching memories' do
|
|
40
|
+
events = engine.trigger_nostalgia(trigger: 'school')
|
|
41
|
+
expect(events).to all(be_a(Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEvent))
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'stores events internally' do
|
|
45
|
+
engine.trigger_nostalgia(trigger: 'school')
|
|
46
|
+
expect(engine.events).not_to be_empty
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
context 'when domain is specified' do
|
|
51
|
+
it 'filters candidates by domain' do
|
|
52
|
+
events = engine.trigger_nostalgia(trigger: 'school', domain: :place)
|
|
53
|
+
event_memory_ids = events.map(&:memory_id)
|
|
54
|
+
place_memory = engine.memories.find { |m| m.domain == :place }
|
|
55
|
+
expect(event_memory_ids).to include(place_memory.id) if place_memory && events.any?
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context 'when no memories exist' do
|
|
60
|
+
it 'returns empty array' do
|
|
61
|
+
events = described_class.new.trigger_nostalgia(trigger: 'anything')
|
|
62
|
+
expect(events).to eq([])
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe '#age_all!' do
|
|
68
|
+
it 'increments temporal_distance on all memories' do
|
|
69
|
+
engine.create_memory(content: 'memory 1')
|
|
70
|
+
engine.create_memory(content: 'memory 2')
|
|
71
|
+
engine.age_all!
|
|
72
|
+
engine.memories.each do |m|
|
|
73
|
+
expect(m.temporal_distance).to eq(1)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
describe '#warmth_by_domain' do
|
|
79
|
+
before do
|
|
80
|
+
engine.create_memory(content: 'beach vacation', domain: :place, warmth: 0.7)
|
|
81
|
+
engine.create_memory(content: 'mountain hike', domain: :place, warmth: 0.5)
|
|
82
|
+
engine.create_memory(content: 'first job', domain: :achievement, warmth: 0.8)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it 'returns average warmth per domain' do
|
|
86
|
+
result = engine.warmth_by_domain
|
|
87
|
+
expect(result[:place]).to be_within(0.01).of(0.6)
|
|
88
|
+
expect(result[:achievement]).to be_within(0.01).of(0.8)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'returns a hash' do
|
|
92
|
+
expect(engine.warmth_by_domain).to be_a(Hash)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
describe '#rosy_retrospection_index' do
|
|
97
|
+
context 'with no memories' do
|
|
98
|
+
it 'returns 0.0' do
|
|
99
|
+
expect(engine.rosy_retrospection_index).to eq(0.0)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
context 'with rosy memories' do
|
|
104
|
+
before do
|
|
105
|
+
engine.create_memory(content: 'good times', warmth: 0.9, original_valence: 0.3)
|
|
106
|
+
engine.create_memory(content: 'average times', warmth: 0.4, original_valence: 0.4)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'returns a value in [0, 1]' do
|
|
110
|
+
expect(engine.rosy_retrospection_index).to be_between(0.0, 1.0)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
describe '#nostalgia_proneness' do
|
|
116
|
+
context 'with no memories' do
|
|
117
|
+
it 'returns 0.0' do
|
|
118
|
+
expect(engine.nostalgia_proneness).to eq(0.0)
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
context 'with highly warm memories' do
|
|
123
|
+
before do
|
|
124
|
+
5.times { |i| engine.create_memory(content: "memory #{i}", warmth: 0.8) }
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'returns a higher proneness' do
|
|
128
|
+
expect(engine.nostalgia_proneness).to be > 0.3
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
describe '#most_nostalgic_domains' do
|
|
134
|
+
before do
|
|
135
|
+
engine.create_memory(content: 'beach', domain: :place, warmth: 0.9)
|
|
136
|
+
engine.create_memory(content: 'win', domain: :achievement, warmth: 0.5)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'returns domains sorted by avg warmth descending' do
|
|
140
|
+
result = engine.most_nostalgic_domains
|
|
141
|
+
expect(result.first[:domain]).to eq(:place)
|
|
142
|
+
expect(result.map { |d| d[:domain] }).to include(:place, :achievement)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it 'includes avg_warmth key' do
|
|
146
|
+
result = engine.most_nostalgic_domains
|
|
147
|
+
expect(result.first).to have_key(:avg_warmth)
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
describe '#bittersweet_memories' do
|
|
152
|
+
before do
|
|
153
|
+
engine.create_memory(content: 'painful but warm', warmth: 0.7, original_valence: 0.2)
|
|
154
|
+
engine.create_memory(content: 'purely pleasant', warmth: 0.8, original_valence: 0.8)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it 'returns only bittersweet memories' do
|
|
158
|
+
result = engine.bittersweet_memories
|
|
159
|
+
expect(result).not_to be_empty
|
|
160
|
+
result.each do |m|
|
|
161
|
+
expect(m[:bittersweet]).to be true
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
describe '#nostalgia_report' do
|
|
167
|
+
before do
|
|
168
|
+
engine.create_memory(content: 'memory a', domain: :place, warmth: 0.7, original_valence: 0.3)
|
|
169
|
+
engine.create_memory(content: 'memory b', domain: :achievement, warmth: 0.5, original_valence: 0.6)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
it 'includes all expected keys' do
|
|
173
|
+
report = engine.nostalgia_report
|
|
174
|
+
expect(report).to include(
|
|
175
|
+
:total_memories,
|
|
176
|
+
:total_events,
|
|
177
|
+
:rosy_retrospection_index,
|
|
178
|
+
:retrospection_label,
|
|
179
|
+
:nostalgia_proneness,
|
|
180
|
+
:nostalgia_label,
|
|
181
|
+
:most_nostalgic_domains,
|
|
182
|
+
:bittersweet_count,
|
|
183
|
+
:rosy_count
|
|
184
|
+
)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
it 'has correct total_memories' do
|
|
188
|
+
expect(engine.nostalgia_report[:total_memories]).to eq(2)
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEvent do
|
|
4
|
+
subject(:event) do
|
|
5
|
+
described_class.new(
|
|
6
|
+
memory_id: 'abc-123',
|
|
7
|
+
trigger: 'old song',
|
|
8
|
+
intensity: 0.7,
|
|
9
|
+
effect_on_mood: 0.4
|
|
10
|
+
)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#initialize' do
|
|
14
|
+
it 'assigns a uuid id' do
|
|
15
|
+
expect(event.id).to match(/\A[0-9a-f-]{36}\z/)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'stores memory_id' do
|
|
19
|
+
expect(event.memory_id).to eq('abc-123')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'stores trigger' do
|
|
23
|
+
expect(event.trigger).to eq('old song')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'clamps intensity to [0, 1]' do
|
|
27
|
+
e = described_class.new(memory_id: 'x', trigger: 't', intensity: 1.8)
|
|
28
|
+
expect(e.intensity).to eq(1.0)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'clamps effect_on_mood to [-1, 1]' do
|
|
32
|
+
e = described_class.new(memory_id: 'x', trigger: 't', intensity: 0.5, effect_on_mood: 2.0)
|
|
33
|
+
expect(e.effect_on_mood).to eq(1.0)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'defaults effect_on_mood to 0.0' do
|
|
37
|
+
e = described_class.new(memory_id: 'x', trigger: 't', intensity: 0.5)
|
|
38
|
+
expect(e.effect_on_mood).to eq(0.0)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe '#nostalgia_label' do
|
|
43
|
+
it 'returns a symbol' do
|
|
44
|
+
expect(event.nostalgia_label).to be_a(Symbol)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'returns :vivid for intensity 0.7' do
|
|
48
|
+
expect(event.nostalgia_label).to eq(:vivid)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe '#to_h' do
|
|
53
|
+
it 'includes all fields' do
|
|
54
|
+
h = event.to_h
|
|
55
|
+
expect(h).to include(:id, :memory_id, :trigger, :intensity, :nostalgia_label,
|
|
56
|
+
:effect_on_mood, :occurred_at)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgicMemory do
|
|
4
|
+
subject(:memory) { described_class.new(content: 'summer camp', domain: :place, original_valence: 0.6) }
|
|
5
|
+
|
|
6
|
+
describe '#initialize' do
|
|
7
|
+
it 'assigns a uuid id' do
|
|
8
|
+
expect(memory.id).to match(/\A[0-9a-f-]{36}\z/)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'stores content' do
|
|
12
|
+
expect(memory.content).to eq('summer camp')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'normalizes domain' do
|
|
16
|
+
expect(memory.domain).to eq(:place)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'defaults temporal_distance to 0' do
|
|
20
|
+
expect(memory.temporal_distance).to eq(0)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'clamps unknown domain to :unknown' do
|
|
24
|
+
m = described_class.new(content: 'test', domain: :bogus)
|
|
25
|
+
expect(m.domain).to eq(:unknown)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'clamps warmth to WARMTH_CEILING' do
|
|
29
|
+
m = described_class.new(content: 'test', warmth: 1.5)
|
|
30
|
+
expect(m.warmth).to be <= Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::Constants::WARMTH_CEILING
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe '#age!' do
|
|
35
|
+
it 'increments temporal_distance' do
|
|
36
|
+
memory.age!
|
|
37
|
+
expect(memory.temporal_distance).to eq(1)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'increases warmth' do
|
|
41
|
+
original = memory.warmth
|
|
42
|
+
memory.age!
|
|
43
|
+
expect(memory.warmth).to be > original
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'returns self for chaining' do
|
|
47
|
+
expect(memory.age!).to eq(memory)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'does not exceed WARMTH_CEILING after many ages' do
|
|
51
|
+
100.times { memory.age! }
|
|
52
|
+
expect(memory.warmth).to be <= Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::Constants::WARMTH_CEILING
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe '#warm!' do
|
|
57
|
+
it 'increases warmth' do
|
|
58
|
+
original = memory.warmth
|
|
59
|
+
memory.warm!(0.1)
|
|
60
|
+
expect(memory.warmth).to be > original
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'returns self for chaining' do
|
|
64
|
+
expect(memory.warm!).to eq(memory)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'does not exceed WARMTH_CEILING' do
|
|
68
|
+
50.times { memory.warm!(0.5) }
|
|
69
|
+
expect(memory.warmth).to be <= Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::Constants::WARMTH_CEILING
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe '#cool!' do
|
|
74
|
+
it 'decreases warmth' do
|
|
75
|
+
memory.warm!(0.3)
|
|
76
|
+
before = memory.warmth
|
|
77
|
+
memory.cool!(0.1)
|
|
78
|
+
expect(memory.warmth).to be < before
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'does not go below 0' do
|
|
82
|
+
m = described_class.new(content: 'test', warmth: 0.0)
|
|
83
|
+
m.cool!(1.0)
|
|
84
|
+
expect(m.warmth).to eq(0.0)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it 'returns self for chaining' do
|
|
88
|
+
expect(memory.cool!).to eq(memory)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe '#rosy?' do
|
|
93
|
+
it 'returns false when warmth equals original_valence' do
|
|
94
|
+
m = described_class.new(content: 'test', warmth: 0.5, original_valence: 0.5)
|
|
95
|
+
expect(m.rosy?).to be false
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'returns true when warmth exceeds original_valence' do
|
|
99
|
+
m = described_class.new(content: 'test', warmth: 0.8, original_valence: 0.3)
|
|
100
|
+
expect(m.rosy?).to be true
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
describe '#bittersweet?' do
|
|
105
|
+
it 'returns true for high warmth but low original valence' do
|
|
106
|
+
m = described_class.new(content: 'test', warmth: 0.7, original_valence: 0.2)
|
|
107
|
+
expect(m.bittersweet?).to be true
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'returns false for high warmth and high original valence' do
|
|
111
|
+
m = described_class.new(content: 'test', warmth: 0.8, original_valence: 0.8)
|
|
112
|
+
expect(m.bittersweet?).to be false
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'returns false for low warmth' do
|
|
116
|
+
m = described_class.new(content: 'test', warmth: 0.2, original_valence: 0.1)
|
|
117
|
+
expect(m.bittersweet?).to be false
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe '#warmth_label' do
|
|
122
|
+
it 'returns a symbol' do
|
|
123
|
+
expect(memory.warmth_label).to be_a(Symbol)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
describe '#to_h' do
|
|
128
|
+
it 'includes all key fields' do
|
|
129
|
+
h = memory.to_h
|
|
130
|
+
expect(h).to include(:id, :content, :domain, :warmth, :warmth_label, :temporal_distance,
|
|
131
|
+
:original_valence, :current_valence, :rosy, :bittersweet, :created_at)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Nostalgia::Runners::Analysis do
|
|
4
|
+
let(:engine) { Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEngine.new }
|
|
5
|
+
|
|
6
|
+
let(:client) do
|
|
7
|
+
Class.new do
|
|
8
|
+
include Legion::Extensions::Agentic::Memory::Nostalgia::Runners::Analysis
|
|
9
|
+
end.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
before do
|
|
13
|
+
engine.create_memory(content: 'great vacation', domain: :place, warmth: 0.8, original_valence: 0.4)
|
|
14
|
+
engine.create_memory(content: 'promotion day', domain: :achievement, warmth: 0.6, original_valence: 0.7)
|
|
15
|
+
engine.create_memory(content: 'tough breakup', domain: :relationship, warmth: 0.7, original_valence: 0.2)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '#warmth_by_domain' do
|
|
19
|
+
it 'returns success: true' do
|
|
20
|
+
result = client.warmth_by_domain(engine: engine)
|
|
21
|
+
expect(result[:success]).to be true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'returns warmth_by_domain hash' do
|
|
25
|
+
result = client.warmth_by_domain(engine: engine)
|
|
26
|
+
expect(result[:warmth_by_domain]).to be_a(Hash)
|
|
27
|
+
expect(result[:warmth_by_domain]).to have_key(:place)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe '#rosy_retrospection_index' do
|
|
32
|
+
it 'returns success: true' do
|
|
33
|
+
result = client.rosy_retrospection_index(engine: engine)
|
|
34
|
+
expect(result[:success]).to be true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'returns index in [0, 1]' do
|
|
38
|
+
result = client.rosy_retrospection_index(engine: engine)
|
|
39
|
+
expect(result[:index]).to be_between(0.0, 1.0)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'returns a retrospection label' do
|
|
43
|
+
result = client.rosy_retrospection_index(engine: engine)
|
|
44
|
+
expect(result[:label]).to be_a(Symbol)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe '#nostalgia_proneness' do
|
|
49
|
+
it 'returns success: true' do
|
|
50
|
+
result = client.nostalgia_proneness(engine: engine)
|
|
51
|
+
expect(result[:success]).to be true
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'returns proneness in [0, 1]' do
|
|
55
|
+
result = client.nostalgia_proneness(engine: engine)
|
|
56
|
+
expect(result[:proneness]).to be_between(0.0, 1.0)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'returns a nostalgia label' do
|
|
60
|
+
result = client.nostalgia_proneness(engine: engine)
|
|
61
|
+
expect(result[:label]).to be_a(Symbol)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe '#most_nostalgic_domains' do
|
|
66
|
+
it 'returns success: true' do
|
|
67
|
+
result = client.most_nostalgic_domains(engine: engine)
|
|
68
|
+
expect(result[:success]).to be true
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'returns sorted domains' do
|
|
72
|
+
result = client.most_nostalgic_domains(engine: engine)
|
|
73
|
+
domains = result[:domains]
|
|
74
|
+
expect(domains).to be_an(Array)
|
|
75
|
+
expect(domains.first[:avg_warmth]).to be >= domains.last[:avg_warmth]
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe '#bittersweet_memories' do
|
|
80
|
+
it 'returns success: true' do
|
|
81
|
+
result = client.bittersweet_memories(engine: engine)
|
|
82
|
+
expect(result[:success]).to be true
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it 'returns only bittersweet memories' do
|
|
86
|
+
result = client.bittersweet_memories(engine: engine)
|
|
87
|
+
expect(result[:memories]).to be_an(Array)
|
|
88
|
+
expect(result[:count]).to eq(result[:memories].size)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'identifies the tough breakup as bittersweet' do
|
|
92
|
+
result = client.bittersweet_memories(engine: engine)
|
|
93
|
+
contents = result[:memories].map { |m| m[:content] }
|
|
94
|
+
expect(contents).to include('tough breakup')
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Nostalgia::Runners::Recall do
|
|
4
|
+
let(:engine) { Legion::Extensions::Agentic::Memory::Nostalgia::Helpers::NostalgiaEngine.new }
|
|
5
|
+
|
|
6
|
+
let(:client) do
|
|
7
|
+
Class.new do
|
|
8
|
+
include Legion::Extensions::Agentic::Memory::Nostalgia::Runners::Recall
|
|
9
|
+
end.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe '#store_memory' do
|
|
13
|
+
it 'returns success: true' do
|
|
14
|
+
result = client.store_memory(content: 'old school', engine: engine)
|
|
15
|
+
expect(result[:success]).to be true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'includes memory hash' do
|
|
19
|
+
result = client.store_memory(content: 'old school', engine: engine)
|
|
20
|
+
expect(result[:memory]).to include(:id, :content, :domain, :warmth)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'stores memory in engine' do
|
|
24
|
+
client.store_memory(content: 'test memory', domain: :place, engine: engine)
|
|
25
|
+
expect(engine.memories.size).to eq(1)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#trigger_nostalgia' do
|
|
30
|
+
before do
|
|
31
|
+
engine.create_memory(content: 'summer in the park', domain: :place, original_valence: 0.5)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'returns success: true' do
|
|
35
|
+
result = client.trigger_nostalgia(trigger: 'summer', engine: engine)
|
|
36
|
+
expect(result[:success]).to be true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'includes events array' do
|
|
40
|
+
result = client.trigger_nostalgia(trigger: 'summer', engine: engine)
|
|
41
|
+
expect(result[:events]).to be_an(Array)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'includes count' do
|
|
45
|
+
result = client.trigger_nostalgia(trigger: 'summer', engine: engine)
|
|
46
|
+
expect(result[:count]).to eq(result[:events].size)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe '#age_memories' do
|
|
51
|
+
before do
|
|
52
|
+
engine.create_memory(content: 'memory')
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'returns success: true' do
|
|
56
|
+
result = client.age_memories(engine: engine)
|
|
57
|
+
expect(result[:success]).to be true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'includes memory_count' do
|
|
61
|
+
result = client.age_memories(engine: engine)
|
|
62
|
+
expect(result[:memory_count]).to eq(1)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe '#nostalgia_report' do
|
|
67
|
+
before do
|
|
68
|
+
engine.create_memory(content: 'report memory', warmth: 0.6, original_valence: 0.3)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'returns success: true' do
|
|
72
|
+
result = client.nostalgia_report(engine: engine)
|
|
73
|
+
expect(result[:success]).to be true
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'includes report fields' do
|
|
77
|
+
result = client.nostalgia_report(engine: engine)
|
|
78
|
+
expect(result).to include(:total_memories, :rosy_retrospection_index, :nostalgia_proneness)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/memory/offloading/client'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Offloading::Client do
|
|
6
|
+
let(:client) { described_class.new }
|
|
7
|
+
|
|
8
|
+
it 'responds to all runner methods' do
|
|
9
|
+
expect(client).to respond_to(:register_store)
|
|
10
|
+
expect(client).to respond_to(:offload_item)
|
|
11
|
+
expect(client).to respond_to(:retrieve_item)
|
|
12
|
+
expect(client).to respond_to(:report_retrieval_failure)
|
|
13
|
+
expect(client).to respond_to(:items_in_store)
|
|
14
|
+
expect(client).to respond_to(:items_by_type)
|
|
15
|
+
expect(client).to respond_to(:most_important_offloaded)
|
|
16
|
+
expect(client).to respond_to(:offloading_status)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'accepts an injected engine' do
|
|
20
|
+
engine = Legion::Extensions::Agentic::Memory::Offloading::Helpers::OffloadingEngine.new
|
|
21
|
+
c = described_class.new(engine: engine)
|
|
22
|
+
result = c.register_store(name: 'test', store_type: :file)
|
|
23
|
+
expect(result[:success]).to be true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'creates its own engine when none injected' do
|
|
27
|
+
result = client.register_store(name: 'auto', store_type: :notes)
|
|
28
|
+
expect(result[:success]).to be true
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Legion::Extensions::Agentic::Memory::Offloading::Helpers::Constants do
|
|
4
|
+
subject(:constants) { described_class }
|
|
5
|
+
|
|
6
|
+
it 'defines MAX_ITEMS as 500' do
|
|
7
|
+
expect(constants::MAX_ITEMS).to eq(500)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'defines MAX_STORES as 50' do
|
|
11
|
+
expect(constants::MAX_STORES).to eq(50)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'defines DEFAULT_STORE_TRUST as 0.7' do
|
|
15
|
+
expect(constants::DEFAULT_STORE_TRUST).to eq(0.7)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'defines TRUST_DECAY as 0.02' do
|
|
19
|
+
expect(constants::TRUST_DECAY).to eq(0.02)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'defines TRUST_BOOST as 0.05' do
|
|
23
|
+
expect(constants::TRUST_BOOST).to eq(0.05)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'defines RETRIEVAL_SUCCESS_THRESHOLD as 0.7' do
|
|
27
|
+
expect(constants::RETRIEVAL_SUCCESS_THRESHOLD).to eq(0.7)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'defines ITEM_TYPES as frozen array of symbols' do
|
|
31
|
+
expect(constants::ITEM_TYPES).to include(:fact, :procedure, :plan, :context, :delegation,
|
|
32
|
+
:reminder, :calculation, :reference)
|
|
33
|
+
expect(constants::ITEM_TYPES).to be_frozen
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'defines STORE_TYPES as frozen array of symbols' do
|
|
37
|
+
expect(constants::STORE_TYPES).to include(:database, :file, :agent, :tool, :memory_aid,
|
|
38
|
+
:external_service, :notes)
|
|
39
|
+
expect(constants::STORE_TYPES).to be_frozen
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'maps high trust to :highly_trusted' do
|
|
43
|
+
label = constants::TRUST_LABELS.find { |range, _| range.cover?(0.9) }&.last
|
|
44
|
+
expect(label).to eq(:highly_trusted)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'maps moderate trust to :trusted' do
|
|
48
|
+
label = constants::TRUST_LABELS.find { |range, _| range.cover?(0.7) }&.last
|
|
49
|
+
expect(label).to eq(:trusted)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'maps low trust to :unreliable' do
|
|
53
|
+
label = constants::TRUST_LABELS.find { |range, _| range.cover?(0.1) }&.last
|
|
54
|
+
expect(label).to eq(:unreliable)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'maps high importance to :critical' do
|
|
58
|
+
label = constants::IMPORTANCE_LABELS.find { |range, _| range.cover?(0.9) }&.last
|
|
59
|
+
expect(label).to eq(:critical)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'maps high offloading ratio to :heavily_offloaded' do
|
|
63
|
+
label = constants::OFFLOAD_LABELS.find { |range, _| range.cover?(0.9) }&.last
|
|
64
|
+
expect(label).to eq(:heavily_offloaded)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'maps low offloading ratio to :self_reliant' do
|
|
68
|
+
label = constants::OFFLOAD_LABELS.find { |range, _| range.cover?(0.1) }&.last
|
|
69
|
+
expect(label).to eq(:self_reliant)
|
|
70
|
+
end
|
|
71
|
+
end
|