lex-agentic-social 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-social.gemspec +30 -0
- data/lib/legion/extensions/agentic/social/apprenticeship/client.rb +28 -0
- data/lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship.rb +90 -0
- data/lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_engine.rb +109 -0
- data/lib/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model.rb +93 -0
- data/lib/legion/extensions/agentic/social/apprenticeship/runners/cognitive_apprenticeship.rb +112 -0
- data/lib/legion/extensions/agentic/social/apprenticeship/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/apprenticeship.rb +19 -0
- data/lib/legion/extensions/agentic/social/conflict/actors/stale_check.rb +45 -0
- data/lib/legion/extensions/agentic/social/conflict/client.rb +27 -0
- data/lib/legion/extensions/agentic/social/conflict/helpers/conflict_log.rb +70 -0
- data/lib/legion/extensions/agentic/social/conflict/helpers/llm_enhancer.rb +130 -0
- data/lib/legion/extensions/agentic/social/conflict/helpers/severity.rb +47 -0
- data/lib/legion/extensions/agentic/social/conflict/runners/conflict.rb +112 -0
- data/lib/legion/extensions/agentic/social/conflict/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/conflict.rb +19 -0
- data/lib/legion/extensions/agentic/social/conscience/client.rb +26 -0
- data/lib/legion/extensions/agentic/social/conscience/helpers/constants.rb +53 -0
- data/lib/legion/extensions/agentic/social/conscience/helpers/moral_evaluator.rb +178 -0
- data/lib/legion/extensions/agentic/social/conscience/helpers/moral_store.rb +116 -0
- data/lib/legion/extensions/agentic/social/conscience/runners/conscience.rb +117 -0
- data/lib/legion/extensions/agentic/social/conscience/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/conscience.rb +19 -0
- data/lib/legion/extensions/agentic/social/consent/actors/tier_evaluation.rb +45 -0
- data/lib/legion/extensions/agentic/social/consent/client.rb +27 -0
- data/lib/legion/extensions/agentic/social/consent/helpers/consent_map.rb +199 -0
- data/lib/legion/extensions/agentic/social/consent/helpers/tiers.rb +54 -0
- data/lib/legion/extensions/agentic/social/consent/local_migrations/20260316000010_create_consent_domains.rb +16 -0
- data/lib/legion/extensions/agentic/social/consent/runners/consent.rb +228 -0
- data/lib/legion/extensions/agentic/social/consent/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/consent.rb +25 -0
- data/lib/legion/extensions/agentic/social/entrainment/client.rb +19 -0
- data/lib/legion/extensions/agentic/social/entrainment/helpers/constants.rb +40 -0
- data/lib/legion/extensions/agentic/social/entrainment/helpers/entrainment_engine.rb +120 -0
- data/lib/legion/extensions/agentic/social/entrainment/helpers/pairing.rb +86 -0
- data/lib/legion/extensions/agentic/social/entrainment/runners/cognitive_entrainment.rb +89 -0
- data/lib/legion/extensions/agentic/social/entrainment/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/entrainment.rb +19 -0
- data/lib/legion/extensions/agentic/social/governance/actors/shadow_ai_scan.rb +19 -0
- data/lib/legion/extensions/agentic/social/governance/actors/vote_timeout.rb +45 -0
- data/lib/legion/extensions/agentic/social/governance/client.rb +27 -0
- data/lib/legion/extensions/agentic/social/governance/helpers/layers.rb +40 -0
- data/lib/legion/extensions/agentic/social/governance/helpers/proposal.rb +94 -0
- data/lib/legion/extensions/agentic/social/governance/runners/governance.rb +87 -0
- data/lib/legion/extensions/agentic/social/governance/runners/shadow_ai.rb +93 -0
- data/lib/legion/extensions/agentic/social/governance/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/governance.rb +20 -0
- data/lib/legion/extensions/agentic/social/joint_attention/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/social/joint_attention/client.rb +28 -0
- data/lib/legion/extensions/agentic/social/joint_attention/helpers/attention_target.rb +124 -0
- data/lib/legion/extensions/agentic/social/joint_attention/helpers/constants.rb +34 -0
- data/lib/legion/extensions/agentic/social/joint_attention/helpers/joint_focus_manager.rb +157 -0
- data/lib/legion/extensions/agentic/social/joint_attention/runners/joint_attention.rb +88 -0
- data/lib/legion/extensions/agentic/social/joint_attention/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/joint_attention.rb +20 -0
- data/lib/legion/extensions/agentic/social/mentalizing/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/social/mentalizing/client.rb +28 -0
- data/lib/legion/extensions/agentic/social/mentalizing/helpers/belief_attribution.rb +58 -0
- data/lib/legion/extensions/agentic/social/mentalizing/helpers/constants.rb +33 -0
- data/lib/legion/extensions/agentic/social/mentalizing/helpers/mental_model.rb +137 -0
- data/lib/legion/extensions/agentic/social/mentalizing/runners/mentalizing.rb +93 -0
- data/lib/legion/extensions/agentic/social/mentalizing/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/mentalizing.rb +20 -0
- data/lib/legion/extensions/agentic/social/mirror/client.rb +33 -0
- data/lib/legion/extensions/agentic/social/mirror/helpers/constants.rb +65 -0
- data/lib/legion/extensions/agentic/social/mirror/helpers/mirror_engine.rb +132 -0
- data/lib/legion/extensions/agentic/social/mirror/helpers/mirror_event.rb +46 -0
- data/lib/legion/extensions/agentic/social/mirror/helpers/simulation.rb +43 -0
- data/lib/legion/extensions/agentic/social/mirror/runners/observe.rb +52 -0
- data/lib/legion/extensions/agentic/social/mirror/runners/resonance.rb +79 -0
- data/lib/legion/extensions/agentic/social/mirror/runners/simulate.rb +63 -0
- data/lib/legion/extensions/agentic/social/mirror/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/mirror.rb +22 -0
- data/lib/legion/extensions/agentic/social/mirror_system/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/social/mirror_system/client.rb +28 -0
- data/lib/legion/extensions/agentic/social/mirror_system/helpers/constants.rb +62 -0
- data/lib/legion/extensions/agentic/social/mirror_system/helpers/mirror_system.rb +162 -0
- data/lib/legion/extensions/agentic/social/mirror_system/helpers/observed_behavior.rb +67 -0
- data/lib/legion/extensions/agentic/social/mirror_system/runners/mirror.rb +99 -0
- data/lib/legion/extensions/agentic/social/mirror_system/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/mirror_system.rb +20 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/client.rb +19 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/helpers/constants.rb +49 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/helpers/dilemma.rb +68 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/helpers/llm_enhancer.rb +140 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/helpers/moral_engine.rb +239 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/helpers/moral_foundation.rb +45 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/runners/moral_reasoning.rb +121 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/moral_reasoning.rb +21 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/client.rb +29 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/helpers/constants.rb +67 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective.rb +45 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/helpers/perspective_view.rb +57 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/helpers/shifting_engine.rb +166 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/runners/perspective_shifting.rb +167 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/perspective_shifting.rb +20 -0
- data/lib/legion/extensions/agentic/social/social/client.rb +25 -0
- data/lib/legion/extensions/agentic/social/social/helpers/constants.rb +84 -0
- data/lib/legion/extensions/agentic/social/social/helpers/social_graph.rb +172 -0
- data/lib/legion/extensions/agentic/social/social/runners/social.rb +146 -0
- data/lib/legion/extensions/agentic/social/social/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/social.rb +18 -0
- data/lib/legion/extensions/agentic/social/social_learning/client.rb +25 -0
- data/lib/legion/extensions/agentic/social/social_learning/helpers/constants.rb +42 -0
- data/lib/legion/extensions/agentic/social/social_learning/helpers/model_agent.rb +82 -0
- data/lib/legion/extensions/agentic/social/social_learning/helpers/observed_behavior.rb +61 -0
- data/lib/legion/extensions/agentic/social/social_learning/helpers/social_learning_engine.rb +134 -0
- data/lib/legion/extensions/agentic/social/social_learning/runners/social_learning.rb +105 -0
- data/lib/legion/extensions/agentic/social/social_learning/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/social_learning.rb +20 -0
- data/lib/legion/extensions/agentic/social/symbiosis/client.rb +23 -0
- data/lib/legion/extensions/agentic/social/symbiosis/helpers/constants.rb +50 -0
- data/lib/legion/extensions/agentic/social/symbiosis/helpers/ecosystem.rb +113 -0
- data/lib/legion/extensions/agentic/social/symbiosis/helpers/symbiosis_engine.rb +104 -0
- data/lib/legion/extensions/agentic/social/symbiosis/helpers/symbiotic_bond.rb +112 -0
- data/lib/legion/extensions/agentic/social/symbiosis/runners/cognitive_symbiosis.rb +101 -0
- data/lib/legion/extensions/agentic/social/symbiosis/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/symbiosis.rb +22 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind/client.rb +26 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind/helpers/agent_model.rb +173 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind/helpers/constants.rb +70 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind/helpers/mental_state_tracker.rb +169 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind/runners/theory_of_mind.rb +159 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/theory_of_mind.rb +19 -0
- data/lib/legion/extensions/agentic/social/trust/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/social/trust/client.rb +27 -0
- data/lib/legion/extensions/agentic/social/trust/helpers/trust_map.rb +160 -0
- data/lib/legion/extensions/agentic/social/trust/helpers/trust_model.rb +52 -0
- data/lib/legion/extensions/agentic/social/trust/local_migrations/20260316000020_create_trust_entries.rb +23 -0
- data/lib/legion/extensions/agentic/social/trust/runners/trust.rb +80 -0
- data/lib/legion/extensions/agentic/social/trust/version.rb +13 -0
- data/lib/legion/extensions/agentic/social/trust.rb +25 -0
- data/lib/legion/extensions/agentic/social/version.rb +11 -0
- data/lib/legion/extensions/agentic/social.rb +34 -0
- data/spec/legion/extensions/agentic/social/apprenticeship/client_spec.rb +20 -0
- data/spec/legion/extensions/agentic/social/apprenticeship/cognitive_apprenticeship_spec.rb +11 -0
- data/spec/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_engine_spec.rb +146 -0
- data/spec/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_model_spec.rb +124 -0
- data/spec/legion/extensions/agentic/social/apprenticeship/helpers/apprenticeship_spec.rb +136 -0
- data/spec/legion/extensions/agentic/social/apprenticeship/runners/cognitive_apprenticeship_spec.rb +154 -0
- data/spec/legion/extensions/agentic/social/conflict/actors/stale_check_spec.rb +45 -0
- data/spec/legion/extensions/agentic/social/conflict/client_spec.rb +15 -0
- data/spec/legion/extensions/agentic/social/conflict/helpers/conflict_log_spec.rb +232 -0
- data/spec/legion/extensions/agentic/social/conflict/helpers/llm_enhancer_spec.rb +189 -0
- data/spec/legion/extensions/agentic/social/conflict/helpers/severity_spec.rb +215 -0
- data/spec/legion/extensions/agentic/social/conflict/runners/conflict_spec.rb +151 -0
- data/spec/legion/extensions/agentic/social/conscience/client_spec.rb +58 -0
- data/spec/legion/extensions/agentic/social/conscience/helpers/constants_spec.rb +124 -0
- data/spec/legion/extensions/agentic/social/conscience/helpers/moral_evaluator_spec.rb +253 -0
- data/spec/legion/extensions/agentic/social/conscience/helpers/moral_store_spec.rb +230 -0
- data/spec/legion/extensions/agentic/social/conscience/runners/conscience_spec.rb +239 -0
- data/spec/legion/extensions/agentic/social/consent/actors/tier_evaluation_spec.rb +46 -0
- data/spec/legion/extensions/agentic/social/consent/client_spec.rb +33 -0
- data/spec/legion/extensions/agentic/social/consent/helpers/tiers_spec.rb +49 -0
- data/spec/legion/extensions/agentic/social/consent/local_persistence_spec.rb +234 -0
- data/spec/legion/extensions/agentic/social/consent/runners/consent_spec.rb +224 -0
- data/spec/legion/extensions/agentic/social/entrainment/client_spec.rb +21 -0
- data/spec/legion/extensions/agentic/social/entrainment/helpers/entrainment_engine_spec.rb +116 -0
- data/spec/legion/extensions/agentic/social/entrainment/helpers/pairing_spec.rb +103 -0
- data/spec/legion/extensions/agentic/social/entrainment/runners/cognitive_entrainment_spec.rb +87 -0
- data/spec/legion/extensions/agentic/social/governance/actors/vote_timeout_spec.rb +45 -0
- data/spec/legion/extensions/agentic/social/governance/client_spec.rb +14 -0
- data/spec/legion/extensions/agentic/social/governance/helpers/layers_spec.rb +190 -0
- data/spec/legion/extensions/agentic/social/governance/helpers/proposal_spec.rb +188 -0
- data/spec/legion/extensions/agentic/social/governance/runners/governance_spec.rb +101 -0
- data/spec/legion/extensions/agentic/social/governance/runners/shadow_ai_spec.rb +65 -0
- data/spec/legion/extensions/agentic/social/joint_attention/client_spec.rb +36 -0
- data/spec/legion/extensions/agentic/social/joint_attention/helpers/attention_target_spec.rb +258 -0
- data/spec/legion/extensions/agentic/social/joint_attention/helpers/joint_focus_manager_spec.rb +238 -0
- data/spec/legion/extensions/agentic/social/joint_attention/runners/joint_attention_spec.rb +228 -0
- data/spec/legion/extensions/agentic/social/mentalizing/client_spec.rb +19 -0
- data/spec/legion/extensions/agentic/social/mentalizing/helpers/belief_attribution_spec.rb +108 -0
- data/spec/legion/extensions/agentic/social/mentalizing/helpers/mental_model_spec.rb +179 -0
- data/spec/legion/extensions/agentic/social/mentalizing/runners/mentalizing_spec.rb +162 -0
- data/spec/legion/extensions/agentic/social/mirror/client_spec.rb +92 -0
- data/spec/legion/extensions/agentic/social/mirror/helpers/constants_spec.rb +123 -0
- data/spec/legion/extensions/agentic/social/mirror/helpers/mirror_engine_spec.rb +217 -0
- data/spec/legion/extensions/agentic/social/mirror/helpers/mirror_event_spec.rb +102 -0
- data/spec/legion/extensions/agentic/social/mirror/helpers/simulation_spec.rb +100 -0
- data/spec/legion/extensions/agentic/social/mirror/runners/observe_spec.rb +77 -0
- data/spec/legion/extensions/agentic/social/mirror/runners/resonance_spec.rb +123 -0
- data/spec/legion/extensions/agentic/social/mirror/runners/simulate_spec.rb +103 -0
- data/spec/legion/extensions/agentic/social/mirror_system/client_spec.rb +40 -0
- data/spec/legion/extensions/agentic/social/mirror_system/helpers/mirror_system_spec.rb +144 -0
- data/spec/legion/extensions/agentic/social/mirror_system/helpers/observed_behavior_spec.rb +98 -0
- data/spec/legion/extensions/agentic/social/mirror_system/runners/mirror_spec.rb +122 -0
- data/spec/legion/extensions/agentic/social/moral_reasoning/client_spec.rb +34 -0
- data/spec/legion/extensions/agentic/social/moral_reasoning/helpers/dilemma_spec.rb +108 -0
- data/spec/legion/extensions/agentic/social/moral_reasoning/helpers/llm_enhancer_spec.rb +232 -0
- data/spec/legion/extensions/agentic/social/moral_reasoning/helpers/moral_engine_spec.rb +266 -0
- data/spec/legion/extensions/agentic/social/moral_reasoning/helpers/moral_foundation_spec.rb +70 -0
- data/spec/legion/extensions/agentic/social/moral_reasoning/runners/moral_reasoning_spec.rb +275 -0
- data/spec/legion/extensions/agentic/social/perspective_shifting/client_spec.rb +30 -0
- data/spec/legion/extensions/agentic/social/perspective_shifting/helpers/constants_spec.rb +99 -0
- data/spec/legion/extensions/agentic/social/perspective_shifting/helpers/perspective_spec.rb +77 -0
- data/spec/legion/extensions/agentic/social/perspective_shifting/helpers/perspective_view_spec.rb +105 -0
- data/spec/legion/extensions/agentic/social/perspective_shifting/helpers/shifting_engine_spec.rb +246 -0
- data/spec/legion/extensions/agentic/social/perspective_shifting/runners/perspective_shifting_spec.rb +277 -0
- data/spec/legion/extensions/agentic/social/social/client_spec.rb +72 -0
- data/spec/legion/extensions/agentic/social/social/helpers/constants_spec.rb +99 -0
- data/spec/legion/extensions/agentic/social/social/helpers/social_graph_spec.rb +322 -0
- data/spec/legion/extensions/agentic/social/social/runners/social_spec.rb +220 -0
- data/spec/legion/extensions/agentic/social/social_learning/client_spec.rb +25 -0
- data/spec/legion/extensions/agentic/social/social_learning/helpers/constants_spec.rb +44 -0
- data/spec/legion/extensions/agentic/social/social_learning/helpers/model_agent_spec.rb +120 -0
- data/spec/legion/extensions/agentic/social/social_learning/helpers/observed_behavior_spec.rb +81 -0
- data/spec/legion/extensions/agentic/social/social_learning/helpers/social_learning_engine_spec.rb +196 -0
- data/spec/legion/extensions/agentic/social/social_learning/runners/social_learning_spec.rb +150 -0
- data/spec/legion/extensions/agentic/social/symbiosis/client_spec.rb +45 -0
- data/spec/legion/extensions/agentic/social/symbiosis/helpers/constants_spec.rb +73 -0
- data/spec/legion/extensions/agentic/social/symbiosis/helpers/ecosystem_spec.rb +185 -0
- data/spec/legion/extensions/agentic/social/symbiosis/helpers/symbiosis_engine_spec.rb +182 -0
- data/spec/legion/extensions/agentic/social/symbiosis/helpers/symbiotic_bond_spec.rb +209 -0
- data/spec/legion/extensions/agentic/social/symbiosis/runners/cognitive_symbiosis_spec.rb +182 -0
- data/spec/legion/extensions/agentic/social/theory_of_mind/client_spec.rb +63 -0
- data/spec/legion/extensions/agentic/social/theory_of_mind/helpers/agent_model_spec.rb +244 -0
- data/spec/legion/extensions/agentic/social/theory_of_mind/helpers/constants_spec.rb +71 -0
- data/spec/legion/extensions/agentic/social/theory_of_mind/helpers/mental_state_tracker_spec.rb +228 -0
- data/spec/legion/extensions/agentic/social/theory_of_mind/runners/theory_of_mind_spec.rb +221 -0
- data/spec/legion/extensions/agentic/social/trust/actors/decay_spec.rb +62 -0
- data/spec/legion/extensions/agentic/social/trust/client_spec.rb +17 -0
- data/spec/legion/extensions/agentic/social/trust/helpers/trust_map_spec.rb +299 -0
- data/spec/legion/extensions/agentic/social/trust/helpers/trust_model_spec.rb +179 -0
- data/spec/legion/extensions/agentic/social/trust/local_persistence_spec.rb +359 -0
- data/spec/legion/extensions/agentic/social/trust/runners/trust_spec.rb +84 -0
- data/spec/spec_helper.rb +54 -0
- metadata +319 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
require 'legion/extensions/agentic/social/mentalizing/version'
|
|
5
|
+
require 'legion/extensions/agentic/social/mentalizing/helpers/constants'
|
|
6
|
+
require 'legion/extensions/agentic/social/mentalizing/helpers/belief_attribution'
|
|
7
|
+
require 'legion/extensions/agentic/social/mentalizing/helpers/mental_model'
|
|
8
|
+
require 'legion/extensions/agentic/social/mentalizing/runners/mentalizing'
|
|
9
|
+
require 'legion/extensions/agentic/social/mentalizing/client'
|
|
10
|
+
|
|
11
|
+
module Legion
|
|
12
|
+
module Extensions
|
|
13
|
+
module Agentic
|
|
14
|
+
module Social
|
|
15
|
+
module Mentalizing
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/social/mirror/helpers/constants'
|
|
4
|
+
require 'legion/extensions/agentic/social/mirror/helpers/mirror_event'
|
|
5
|
+
require 'legion/extensions/agentic/social/mirror/helpers/simulation'
|
|
6
|
+
require 'legion/extensions/agentic/social/mirror/helpers/mirror_engine'
|
|
7
|
+
require 'legion/extensions/agentic/social/mirror/runners/observe'
|
|
8
|
+
require 'legion/extensions/agentic/social/mirror/runners/simulate'
|
|
9
|
+
require 'legion/extensions/agentic/social/mirror/runners/resonance'
|
|
10
|
+
|
|
11
|
+
module Legion
|
|
12
|
+
module Extensions
|
|
13
|
+
module Agentic
|
|
14
|
+
module Social
|
|
15
|
+
module Mirror
|
|
16
|
+
class Client
|
|
17
|
+
include Runners::Observe
|
|
18
|
+
include Runners::Simulate
|
|
19
|
+
include Runners::Resonance
|
|
20
|
+
|
|
21
|
+
def initialize(**)
|
|
22
|
+
@mirror_engine = Helpers::MirrorEngine.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
attr_reader :mirror_engine
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Social
|
|
7
|
+
module Mirror
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
MAX_EVENTS = 500
|
|
11
|
+
MAX_SIMULATIONS = 300
|
|
12
|
+
DEFAULT_RESONANCE = 0.5
|
|
13
|
+
RESONANCE_BOOST = 0.1
|
|
14
|
+
RESONANCE_DECAY = 0.03
|
|
15
|
+
SIMULATION_CONFIDENCE_DEFAULT = 0.5
|
|
16
|
+
|
|
17
|
+
ACTION_TYPES = %i[
|
|
18
|
+
movement
|
|
19
|
+
communication
|
|
20
|
+
decision
|
|
21
|
+
emotional_expression
|
|
22
|
+
creative_act
|
|
23
|
+
analytical_task
|
|
24
|
+
social_interaction
|
|
25
|
+
unknown
|
|
26
|
+
].freeze
|
|
27
|
+
|
|
28
|
+
RESONANCE_LABELS = {
|
|
29
|
+
(0.0..0.2) => :minimal,
|
|
30
|
+
(0.2..0.4) => :low,
|
|
31
|
+
(0.4..0.6) => :moderate,
|
|
32
|
+
(0.6..0.8) => :high,
|
|
33
|
+
(0.8..1.0) => :deep
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
36
|
+
CONFIDENCE_LABELS = {
|
|
37
|
+
(0.0..0.2) => :uncertain,
|
|
38
|
+
(0.2..0.4) => :tentative,
|
|
39
|
+
(0.4..0.6) => :plausible,
|
|
40
|
+
(0.6..0.8) => :confident,
|
|
41
|
+
(0.8..1.0) => :certain
|
|
42
|
+
}.freeze
|
|
43
|
+
|
|
44
|
+
EMPATHY_LABELS = {
|
|
45
|
+
(0.0..0.2) => :detached,
|
|
46
|
+
(0.2..0.4) => :aware,
|
|
47
|
+
(0.4..0.6) => :attuned,
|
|
48
|
+
(0.6..0.8) => :resonant,
|
|
49
|
+
(0.8..1.0) => :immersed
|
|
50
|
+
}.freeze
|
|
51
|
+
|
|
52
|
+
def self.label_for(labels_hash, value)
|
|
53
|
+
clamped = value.clamp(0.0, 1.0)
|
|
54
|
+
labels_hash.each do |range, label|
|
|
55
|
+
return label if range.cover?(clamped)
|
|
56
|
+
end
|
|
57
|
+
labels_hash.values.last
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Social
|
|
7
|
+
module Mirror
|
|
8
|
+
module Helpers
|
|
9
|
+
class MirrorEngine
|
|
10
|
+
INTENT_MAP = {
|
|
11
|
+
communication: :inform_or_persuade,
|
|
12
|
+
decision: :resolve_uncertainty,
|
|
13
|
+
emotional_expression: :signal_internal_state,
|
|
14
|
+
creative_act: :generate_novelty,
|
|
15
|
+
analytical_task: :reduce_uncertainty,
|
|
16
|
+
social_interaction: :build_relationship,
|
|
17
|
+
movement: :change_position
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
attr_reader :events, :simulations, :resonance_map
|
|
21
|
+
|
|
22
|
+
def initialize
|
|
23
|
+
@events = []
|
|
24
|
+
@simulations = []
|
|
25
|
+
@resonance_map = Hash.new(Constants::DEFAULT_RESONANCE)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def observe(agent_id:, action_type:, context: {}, emotional_valence: 0.0)
|
|
29
|
+
event = MirrorEvent.new(
|
|
30
|
+
agent_id: agent_id,
|
|
31
|
+
action_type: action_type,
|
|
32
|
+
context: context,
|
|
33
|
+
emotional_valence: emotional_valence
|
|
34
|
+
)
|
|
35
|
+
@events << event
|
|
36
|
+
@events.shift while @events.size > Constants::MAX_EVENTS
|
|
37
|
+
event
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def simulate(event, confidence: Constants::SIMULATION_CONFIDENCE_DEFAULT)
|
|
41
|
+
resonance = compute_resonance_for(event)
|
|
42
|
+
outcome = derive_outcome(event)
|
|
43
|
+
|
|
44
|
+
sim = Simulation.new(
|
|
45
|
+
event_id: event.id,
|
|
46
|
+
simulated_outcome: outcome,
|
|
47
|
+
confidence: confidence,
|
|
48
|
+
emotional_resonance: resonance
|
|
49
|
+
)
|
|
50
|
+
@simulations << sim
|
|
51
|
+
@simulations.shift while @simulations.size > Constants::MAX_SIMULATIONS
|
|
52
|
+
sim
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def record_accuracy(simulation_id, accuracy)
|
|
56
|
+
sim = @simulations.find { |s| s.id == simulation_id }
|
|
57
|
+
return false unless sim
|
|
58
|
+
|
|
59
|
+
sim.accuracy_score = accuracy.to_f.clamp(0.0, 1.0)
|
|
60
|
+
true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def empathic_resonance(agent_id)
|
|
64
|
+
@resonance_map[agent_id].clamp(0.0, 1.0)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def boost_resonance(agent_id)
|
|
68
|
+
current = @resonance_map[agent_id]
|
|
69
|
+
@resonance_map[agent_id] = (current + Constants::RESONANCE_BOOST).round(10).clamp(0.0, 1.0)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def decay_resonance(agent_id)
|
|
73
|
+
current = @resonance_map[agent_id]
|
|
74
|
+
@resonance_map[agent_id] = (current - Constants::RESONANCE_DECAY).round(10).clamp(0.0, 1.0)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def decay_all_resonances
|
|
78
|
+
@resonance_map.each_key { |agent_id| decay_resonance(agent_id) }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def simulation_accuracy_for(agent_id)
|
|
82
|
+
scored = simulations_for(agent_id).reject { |s| s.accuracy_score.nil? }
|
|
83
|
+
return nil if scored.empty?
|
|
84
|
+
|
|
85
|
+
scored.sum(&:accuracy_score) / scored.size.to_f
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def simulations_for(agent_id)
|
|
89
|
+
event_ids = events_for(agent_id).map(&:id)
|
|
90
|
+
@simulations.select { |s| event_ids.include?(s.event_id) }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def events_for(agent_id)
|
|
94
|
+
@events.select { |e| e.agent_id == agent_id }
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def simulation_history(limit: 20)
|
|
98
|
+
@simulations.last(limit).map(&:to_h)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def known_agents
|
|
102
|
+
@resonance_map.keys
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
private
|
|
106
|
+
|
|
107
|
+
def compute_resonance_for(event)
|
|
108
|
+
base = @resonance_map[event.agent_id]
|
|
109
|
+
valence = event.emotional_valence.abs
|
|
110
|
+
resonance = (base + (valence * Constants::RESONANCE_BOOST)).round(10)
|
|
111
|
+
resonance.clamp(0.0, 1.0)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def derive_outcome(event)
|
|
115
|
+
{
|
|
116
|
+
action_type: event.action_type,
|
|
117
|
+
predicted_intent: infer_intent(event),
|
|
118
|
+
emotional_echo: event.emotional_valence,
|
|
119
|
+
context_keys: event.context.keys
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def infer_intent(event)
|
|
124
|
+
INTENT_MAP.fetch(event.action_type, :unknown_intent)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Agentic
|
|
8
|
+
module Social
|
|
9
|
+
module Mirror
|
|
10
|
+
module Helpers
|
|
11
|
+
class MirrorEvent
|
|
12
|
+
attr_reader :id, :agent_id, :action_type, :context, :emotional_valence, :observed_at
|
|
13
|
+
|
|
14
|
+
def initialize(agent_id:, action_type:, context: {}, emotional_valence: 0.0)
|
|
15
|
+
@id = SecureRandom.uuid
|
|
16
|
+
@agent_id = agent_id
|
|
17
|
+
@action_type = normalize_action_type(action_type)
|
|
18
|
+
@context = context.is_a?(Hash) ? context : {}
|
|
19
|
+
@emotional_valence = emotional_valence.to_f.clamp(-1.0, 1.0)
|
|
20
|
+
@observed_at = Time.now.utc
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def to_h
|
|
24
|
+
{
|
|
25
|
+
id: @id,
|
|
26
|
+
agent_id: @agent_id,
|
|
27
|
+
action_type: @action_type,
|
|
28
|
+
context: @context,
|
|
29
|
+
emotional_valence: @emotional_valence,
|
|
30
|
+
observed_at: @observed_at
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def normalize_action_type(action_type)
|
|
37
|
+
sym = action_type.to_sym
|
|
38
|
+
Constants::ACTION_TYPES.include?(sym) ? sym : :unknown
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Agentic
|
|
8
|
+
module Social
|
|
9
|
+
module Mirror
|
|
10
|
+
module Helpers
|
|
11
|
+
class Simulation
|
|
12
|
+
attr_reader :id, :event_id, :simulated_outcome, :confidence, :emotional_resonance, :simulated_at
|
|
13
|
+
attr_accessor :accuracy_score
|
|
14
|
+
|
|
15
|
+
def initialize(event_id:, simulated_outcome:, confidence: Constants::SIMULATION_CONFIDENCE_DEFAULT,
|
|
16
|
+
emotional_resonance: Constants::DEFAULT_RESONANCE)
|
|
17
|
+
@id = SecureRandom.uuid
|
|
18
|
+
@event_id = event_id
|
|
19
|
+
@simulated_outcome = simulated_outcome
|
|
20
|
+
@confidence = confidence.to_f.clamp(0.0, 1.0)
|
|
21
|
+
@emotional_resonance = emotional_resonance.to_f.clamp(0.0, 1.0)
|
|
22
|
+
@simulated_at = Time.now.utc
|
|
23
|
+
@accuracy_score = nil
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def to_h
|
|
27
|
+
{
|
|
28
|
+
id: @id,
|
|
29
|
+
event_id: @event_id,
|
|
30
|
+
simulated_outcome: @simulated_outcome,
|
|
31
|
+
confidence: @confidence,
|
|
32
|
+
emotional_resonance: @emotional_resonance,
|
|
33
|
+
simulated_at: @simulated_at,
|
|
34
|
+
accuracy_score: @accuracy_score
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Social
|
|
7
|
+
module Mirror
|
|
8
|
+
module Runners
|
|
9
|
+
module Observe
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
11
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
12
|
+
|
|
13
|
+
def observe_action(agent_id:, action_type:, context: {}, emotional_valence: 0.0, engine: nil, **)
|
|
14
|
+
eng = engine || mirror_engine
|
|
15
|
+
|
|
16
|
+
unless Helpers::Constants::ACTION_TYPES.include?(action_type.to_sym)
|
|
17
|
+
Legion::Logging.debug "[cognitive_mirror] unknown action_type=#{action_type}, mapping to :unknown"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
event = eng.observe(
|
|
21
|
+
agent_id: agent_id,
|
|
22
|
+
action_type: action_type,
|
|
23
|
+
context: context,
|
|
24
|
+
emotional_valence: emotional_valence
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
resonance_label = Helpers::Constants.label_for(Helpers::Constants::RESONANCE_LABELS,
|
|
28
|
+
eng.empathic_resonance(agent_id))
|
|
29
|
+
Legion::Logging.debug "[cognitive_mirror] observed action=#{event.action_type} " \
|
|
30
|
+
"agent=#{agent_id} resonance_tier=#{resonance_label}"
|
|
31
|
+
|
|
32
|
+
{ success: true, event: event.to_h, resonance_tier: resonance_label }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def list_events(agent_id: nil, engine: nil, **)
|
|
36
|
+
eng = engine || mirror_engine
|
|
37
|
+
events = agent_id ? eng.events_for(agent_id) : eng.events
|
|
38
|
+
{ success: true, events: events.map(&:to_h), count: events.size }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def mirror_engine
|
|
44
|
+
@mirror_engine ||= Helpers::MirrorEngine.new
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Social
|
|
7
|
+
module Mirror
|
|
8
|
+
module Runners
|
|
9
|
+
module Resonance
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
11
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
12
|
+
|
|
13
|
+
def empathic_resonance(agent_id:, engine: nil, **)
|
|
14
|
+
eng = engine || mirror_engine
|
|
15
|
+
value = eng.empathic_resonance(agent_id)
|
|
16
|
+
accuracy = eng.simulation_accuracy_for(agent_id)
|
|
17
|
+
|
|
18
|
+
empathy_label = Helpers::Constants.label_for(Helpers::Constants::EMPATHY_LABELS, value)
|
|
19
|
+
resonance_label = Helpers::Constants.label_for(Helpers::Constants::RESONANCE_LABELS, value)
|
|
20
|
+
|
|
21
|
+
Legion::Logging.debug "[cognitive_mirror] resonance agent=#{agent_id} " \
|
|
22
|
+
"value=#{value.round(3)} empathy=#{empathy_label}"
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
success: true,
|
|
26
|
+
agent_id: agent_id,
|
|
27
|
+
resonance: value,
|
|
28
|
+
resonance_label: resonance_label,
|
|
29
|
+
empathy_label: empathy_label,
|
|
30
|
+
accuracy: accuracy,
|
|
31
|
+
event_count: eng.events_for(agent_id).size,
|
|
32
|
+
simulation_count: eng.simulations_for(agent_id).size
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def decay_resonances(agent_id: nil, engine: nil, **)
|
|
37
|
+
eng = engine || mirror_engine
|
|
38
|
+
|
|
39
|
+
if agent_id
|
|
40
|
+
eng.decay_resonance(agent_id)
|
|
41
|
+
after = eng.empathic_resonance(agent_id)
|
|
42
|
+
Legion::Logging.debug "[cognitive_mirror] resonance decayed agent=#{agent_id} after=#{after.round(3)}"
|
|
43
|
+
{ success: true, agent_id: agent_id, resonance_after: after }
|
|
44
|
+
else
|
|
45
|
+
eng.decay_all_resonances
|
|
46
|
+
summary = eng.known_agents.to_h { |id| [id, eng.empathic_resonance(id)] }
|
|
47
|
+
Legion::Logging.debug "[cognitive_mirror] global resonance decay agents=#{summary.size}"
|
|
48
|
+
{ success: true, agents_decayed: summary.size, resonances: summary }
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def resonance_summary(engine: nil, **)
|
|
53
|
+
eng = engine || mirror_engine
|
|
54
|
+
agents = eng.known_agents
|
|
55
|
+
|
|
56
|
+
summary = agents.map do |id|
|
|
57
|
+
value = eng.empathic_resonance(id)
|
|
58
|
+
{
|
|
59
|
+
agent_id: id,
|
|
60
|
+
resonance: value,
|
|
61
|
+
empathy_label: Helpers::Constants.label_for(Helpers::Constants::EMPATHY_LABELS, value)
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
{ success: true, agents: summary, total: agents.size }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
private
|
|
69
|
+
|
|
70
|
+
def mirror_engine
|
|
71
|
+
@mirror_engine ||= Helpers::MirrorEngine.new
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Social
|
|
7
|
+
module Mirror
|
|
8
|
+
module Runners
|
|
9
|
+
module Simulate
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
11
|
+
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
12
|
+
|
|
13
|
+
def simulate_action(event_id:, confidence: Helpers::Constants::SIMULATION_CONFIDENCE_DEFAULT,
|
|
14
|
+
engine: nil, **)
|
|
15
|
+
eng = engine || mirror_engine
|
|
16
|
+
|
|
17
|
+
event = eng.events.find { |e| e.id == event_id }
|
|
18
|
+
unless event
|
|
19
|
+
Legion::Logging.debug "[cognitive_mirror] simulate_action: event_id=#{event_id} not found"
|
|
20
|
+
return { success: false, error: 'event not found', event_id: event_id }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
sim = eng.simulate(event, confidence: confidence)
|
|
24
|
+
eng.boost_resonance(event.agent_id)
|
|
25
|
+
|
|
26
|
+
confidence_label = Helpers::Constants.label_for(Helpers::Constants::CONFIDENCE_LABELS, sim.confidence)
|
|
27
|
+
Legion::Logging.debug "[cognitive_mirror] simulated event=#{event_id} " \
|
|
28
|
+
"confidence_tier=#{confidence_label} resonance=#{sim.emotional_resonance.round(3)}"
|
|
29
|
+
|
|
30
|
+
{ success: true, simulation: sim.to_h, confidence_tier: confidence_label }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def record_simulation_accuracy(simulation_id:, accuracy:, engine: nil, **)
|
|
34
|
+
eng = engine || mirror_engine
|
|
35
|
+
recorded = eng.record_accuracy(simulation_id, accuracy)
|
|
36
|
+
|
|
37
|
+
unless recorded
|
|
38
|
+
Legion::Logging.debug "[cognitive_mirror] record_accuracy: simulation_id=#{simulation_id} not found"
|
|
39
|
+
return { success: false, error: 'simulation not found', simulation_id: simulation_id }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Legion::Logging.debug "[cognitive_mirror] accuracy recorded simulation=#{simulation_id} score=#{accuracy}"
|
|
43
|
+
{ success: true, simulation_id: simulation_id, accuracy: accuracy.to_f.clamp(0.0, 1.0) }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def simulation_history(limit: 20, engine: nil, **)
|
|
47
|
+
eng = engine || mirror_engine
|
|
48
|
+
history = eng.simulation_history(limit: limit)
|
|
49
|
+
{ success: true, simulations: history, count: history.size }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def mirror_engine
|
|
55
|
+
@mirror_engine ||= Helpers::MirrorEngine.new
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/social/mirror/version'
|
|
4
|
+
require 'legion/extensions/agentic/social/mirror/helpers/constants'
|
|
5
|
+
require 'legion/extensions/agentic/social/mirror/helpers/mirror_event'
|
|
6
|
+
require 'legion/extensions/agentic/social/mirror/helpers/simulation'
|
|
7
|
+
require 'legion/extensions/agentic/social/mirror/helpers/mirror_engine'
|
|
8
|
+
require 'legion/extensions/agentic/social/mirror/runners/observe'
|
|
9
|
+
require 'legion/extensions/agentic/social/mirror/runners/simulate'
|
|
10
|
+
require 'legion/extensions/agentic/social/mirror/runners/resonance'
|
|
11
|
+
require 'legion/extensions/agentic/social/mirror/client'
|
|
12
|
+
|
|
13
|
+
module Legion
|
|
14
|
+
module Extensions
|
|
15
|
+
module Agentic
|
|
16
|
+
module Social
|
|
17
|
+
module Mirror
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/actors/every'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Agentic
|
|
8
|
+
module Social
|
|
9
|
+
module MirrorSystem
|
|
10
|
+
module Actor
|
|
11
|
+
class Decay < Legion::Extensions::Actors::Every
|
|
12
|
+
def runner_class
|
|
13
|
+
Legion::Extensions::Agentic::Social::MirrorSystem::Runners::Mirror
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def runner_function
|
|
17
|
+
'update_mirror'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def time
|
|
21
|
+
120
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def run_now?
|
|
25
|
+
false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def use_runner?
|
|
29
|
+
false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def check_subtask?
|
|
33
|
+
false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def generate_task?
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/social/mirror_system/helpers/constants'
|
|
4
|
+
require 'legion/extensions/agentic/social/mirror_system/helpers/observed_behavior'
|
|
5
|
+
require 'legion/extensions/agentic/social/mirror_system/helpers/mirror_system'
|
|
6
|
+
require 'legion/extensions/agentic/social/mirror_system/runners/mirror'
|
|
7
|
+
|
|
8
|
+
module Legion
|
|
9
|
+
module Extensions
|
|
10
|
+
module Agentic
|
|
11
|
+
module Social
|
|
12
|
+
module MirrorSystem
|
|
13
|
+
class Client
|
|
14
|
+
include Runners::Mirror
|
|
15
|
+
|
|
16
|
+
def initialize(mirror_system: nil, **)
|
|
17
|
+
@mirror_system = mirror_system || Helpers::MirrorSystem.new
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
attr_reader :mirror_system
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|