lex-agentic-affect 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-affect.gemspec +30 -0
- data/lib/legion/extensions/agentic/affect/appraisal/client.rb +20 -0
- data/lib/legion/extensions/agentic/affect/appraisal/helpers/appraisal.rb +112 -0
- data/lib/legion/extensions/agentic/affect/appraisal/helpers/appraisal_engine.rb +129 -0
- data/lib/legion/extensions/agentic/affect/appraisal/helpers/constants.rb +43 -0
- data/lib/legion/extensions/agentic/affect/appraisal/runners/appraisal.rb +105 -0
- data/lib/legion/extensions/agentic/affect/appraisal/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/appraisal.rb +19 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy/client.rb +19 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy/helpers/constants.rb +37 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy/helpers/empathy_engine.rb +151 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy/helpers/perspective.rb +92 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy/runners/cognitive_empathy.rb +93 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/cognitive_empathy.rb +20 -0
- data/lib/legion/extensions/agentic/affect/contagion/client.rb +28 -0
- data/lib/legion/extensions/agentic/affect/contagion/helpers/constants.rb +34 -0
- data/lib/legion/extensions/agentic/affect/contagion/helpers/contagion_engine.rb +184 -0
- data/lib/legion/extensions/agentic/affect/contagion/helpers/meme.rb +97 -0
- data/lib/legion/extensions/agentic/affect/contagion/runners/cognitive_contagion.rb +125 -0
- data/lib/legion/extensions/agentic/affect/contagion/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/contagion.rb +19 -0
- data/lib/legion/extensions/agentic/affect/defusion/client.rb +28 -0
- data/lib/legion/extensions/agentic/affect/defusion/helpers/constants.rb +64 -0
- data/lib/legion/extensions/agentic/affect/defusion/helpers/defusion_engine.rb +167 -0
- data/lib/legion/extensions/agentic/affect/defusion/helpers/thought.rb +92 -0
- data/lib/legion/extensions/agentic/affect/defusion/runners/cognitive_defusion.rb +127 -0
- data/lib/legion/extensions/agentic/affect/defusion/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/defusion.rb +19 -0
- data/lib/legion/extensions/agentic/affect/emotion/actors/momentum_decay.rb +45 -0
- data/lib/legion/extensions/agentic/affect/emotion/client.rb +36 -0
- data/lib/legion/extensions/agentic/affect/emotion/helpers/baseline.rb +52 -0
- data/lib/legion/extensions/agentic/affect/emotion/helpers/momentum.rb +52 -0
- data/lib/legion/extensions/agentic/affect/emotion/helpers/valence.rb +92 -0
- data/lib/legion/extensions/agentic/affect/emotion/runners/gut.rb +102 -0
- data/lib/legion/extensions/agentic/affect/emotion/runners/valence.rb +120 -0
- data/lib/legion/extensions/agentic/affect/emotion/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/emotion.rb +20 -0
- data/lib/legion/extensions/agentic/affect/empathy/client.rb +21 -0
- data/lib/legion/extensions/agentic/affect/empathy/helpers/constants.rb +54 -0
- data/lib/legion/extensions/agentic/affect/empathy/helpers/mental_model.rb +185 -0
- data/lib/legion/extensions/agentic/affect/empathy/helpers/model_store.rb +88 -0
- data/lib/legion/extensions/agentic/affect/empathy/runners/empathy.rb +173 -0
- data/lib/legion/extensions/agentic/affect/empathy/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/empathy.rb +20 -0
- data/lib/legion/extensions/agentic/affect/fatigue/client.rb +26 -0
- data/lib/legion/extensions/agentic/affect/fatigue/helpers/constants.rb +54 -0
- data/lib/legion/extensions/agentic/affect/fatigue/helpers/energy_model.rb +181 -0
- data/lib/legion/extensions/agentic/affect/fatigue/helpers/fatigue_store.rb +146 -0
- data/lib/legion/extensions/agentic/affect/fatigue/runners/fatigue.rb +89 -0
- data/lib/legion/extensions/agentic/affect/fatigue/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/fatigue.rb +19 -0
- data/lib/legion/extensions/agentic/affect/flow/client.rb +25 -0
- data/lib/legion/extensions/agentic/affect/flow/helpers/constants.rb +84 -0
- data/lib/legion/extensions/agentic/affect/flow/helpers/flow_detector.rb +166 -0
- data/lib/legion/extensions/agentic/affect/flow/runners/flow.rb +129 -0
- data/lib/legion/extensions/agentic/affect/flow/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/flow.rb +18 -0
- data/lib/legion/extensions/agentic/affect/interoception/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/affect/interoception/client.rb +28 -0
- data/lib/legion/extensions/agentic/affect/interoception/helpers/body_budget.rb +152 -0
- data/lib/legion/extensions/agentic/affect/interoception/helpers/constants.rb +68 -0
- data/lib/legion/extensions/agentic/affect/interoception/helpers/somatic_marker.rb +75 -0
- data/lib/legion/extensions/agentic/affect/interoception/runners/interoception.rb +101 -0
- data/lib/legion/extensions/agentic/affect/interoception/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/interoception.rb +20 -0
- data/lib/legion/extensions/agentic/affect/mood/client.rb +21 -0
- data/lib/legion/extensions/agentic/affect/mood/helpers/constants.rb +78 -0
- data/lib/legion/extensions/agentic/affect/mood/helpers/mood_state.rb +154 -0
- data/lib/legion/extensions/agentic/affect/mood/runners/mood.rb +122 -0
- data/lib/legion/extensions/agentic/affect/mood/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/mood.rb +18 -0
- data/lib/legion/extensions/agentic/affect/motivation/client.rb +26 -0
- data/lib/legion/extensions/agentic/affect/motivation/helpers/constants.rb +48 -0
- data/lib/legion/extensions/agentic/affect/motivation/helpers/drive_state.rb +98 -0
- data/lib/legion/extensions/agentic/affect/motivation/helpers/motivation_store.rb +106 -0
- data/lib/legion/extensions/agentic/affect/motivation/runners/motivation.rb +165 -0
- data/lib/legion/extensions/agentic/affect/motivation/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/motivation.rb +19 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/actors/auto_regulate.rb +45 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/client.rb +28 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/helpers/constants.rb +82 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/helpers/emotional_event.rb +98 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/helpers/llm_enhancer.rb +88 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/helpers/reappraisal_engine.rb +153 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/runners/cognitive_reappraisal.rb +164 -0
- data/lib/legion/extensions/agentic/affect/reappraisal/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/reappraisal.rb +20 -0
- data/lib/legion/extensions/agentic/affect/regulation/client.rb +25 -0
- data/lib/legion/extensions/agentic/affect/regulation/helpers/constants.rb +71 -0
- data/lib/legion/extensions/agentic/affect/regulation/helpers/regulation_model.rb +175 -0
- data/lib/legion/extensions/agentic/affect/regulation/runners/emotional_regulation.rb +127 -0
- data/lib/legion/extensions/agentic/affect/regulation/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/regulation.rb +18 -0
- data/lib/legion/extensions/agentic/affect/resilience/client.rb +27 -0
- data/lib/legion/extensions/agentic/affect/resilience/helpers/adversity_tracker.rb +130 -0
- data/lib/legion/extensions/agentic/affect/resilience/helpers/constants.rb +79 -0
- data/lib/legion/extensions/agentic/affect/resilience/helpers/resilience_model.rb +165 -0
- data/lib/legion/extensions/agentic/affect/resilience/runners/resilience.rb +150 -0
- data/lib/legion/extensions/agentic/affect/resilience/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/resilience.rb +19 -0
- data/lib/legion/extensions/agentic/affect/resonance/client.rb +24 -0
- data/lib/legion/extensions/agentic/affect/resonance/helpers/category.rb +75 -0
- data/lib/legion/extensions/agentic/affect/resonance/helpers/constants.rb +47 -0
- data/lib/legion/extensions/agentic/affect/resonance/helpers/resonance_engine.rb +115 -0
- data/lib/legion/extensions/agentic/affect/resonance/runners/cognitive_resonance.rb +94 -0
- data/lib/legion/extensions/agentic/affect/resonance/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/resonance.rb +19 -0
- data/lib/legion/extensions/agentic/affect/reward/client.rb +26 -0
- data/lib/legion/extensions/agentic/affect/reward/helpers/constants.rb +67 -0
- data/lib/legion/extensions/agentic/affect/reward/helpers/reward_signal.rb +178 -0
- data/lib/legion/extensions/agentic/affect/reward/helpers/reward_store.rb +142 -0
- data/lib/legion/extensions/agentic/affect/reward/runners/reward.rb +92 -0
- data/lib/legion/extensions/agentic/affect/reward/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/reward.rb +19 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/actors/decay.rb +45 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/client.rb +29 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/helpers/body_state.rb +69 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/helpers/constants.rb +43 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/helpers/marker_store.rb +160 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/helpers/somatic_marker.rb +74 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/runners/somatic_marker.rb +132 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker/version.rb +13 -0
- data/lib/legion/extensions/agentic/affect/somatic_marker.rb +20 -0
- data/lib/legion/extensions/agentic/affect/version.rb +11 -0
- data/lib/legion/extensions/agentic/affect.rb +34 -0
- data/spec/legion/extensions/agentic/affect/appraisal/client_spec.rb +52 -0
- data/spec/legion/extensions/agentic/affect/appraisal/helpers/appraisal_engine_spec.rb +161 -0
- data/spec/legion/extensions/agentic/affect/appraisal/helpers/appraisal_spec.rb +175 -0
- data/spec/legion/extensions/agentic/affect/appraisal/helpers/constants_spec.rb +49 -0
- data/spec/legion/extensions/agentic/affect/appraisal/runners/appraisal_spec.rb +116 -0
- data/spec/legion/extensions/agentic/affect/cognitive_empathy/client_spec.rb +62 -0
- data/spec/legion/extensions/agentic/affect/cognitive_empathy/helpers/empathy_engine_spec.rb +316 -0
- data/spec/legion/extensions/agentic/affect/cognitive_empathy/helpers/perspective_spec.rb +132 -0
- data/spec/legion/extensions/agentic/affect/cognitive_empathy/runners/cognitive_empathy_spec.rb +200 -0
- data/spec/legion/extensions/agentic/affect/contagion/client_spec.rb +63 -0
- data/spec/legion/extensions/agentic/affect/contagion/helpers/constants_spec.rb +86 -0
- data/spec/legion/extensions/agentic/affect/contagion/helpers/contagion_engine_spec.rb +241 -0
- data/spec/legion/extensions/agentic/affect/contagion/helpers/meme_spec.rb +160 -0
- data/spec/legion/extensions/agentic/affect/contagion/runners/cognitive_contagion_spec.rb +211 -0
- data/spec/legion/extensions/agentic/affect/defusion/client_spec.rb +80 -0
- data/spec/legion/extensions/agentic/affect/defusion/helpers/constants_spec.rb +84 -0
- data/spec/legion/extensions/agentic/affect/defusion/helpers/defusion_engine_spec.rb +250 -0
- data/spec/legion/extensions/agentic/affect/defusion/helpers/thought_spec.rb +178 -0
- data/spec/legion/extensions/agentic/affect/defusion/runners/cognitive_defusion_spec.rb +185 -0
- data/spec/legion/extensions/agentic/affect/emotion/actors/momentum_decay_spec.rb +46 -0
- data/spec/legion/extensions/agentic/affect/emotion/client_spec.rb +46 -0
- data/spec/legion/extensions/agentic/affect/emotion/helpers/baseline_spec.rb +48 -0
- data/spec/legion/extensions/agentic/affect/emotion/helpers/momentum_spec.rb +45 -0
- data/spec/legion/extensions/agentic/affect/emotion/helpers/valence_spec.rb +91 -0
- data/spec/legion/extensions/agentic/affect/emotion/runners/gut_spec.rb +73 -0
- data/spec/legion/extensions/agentic/affect/emotion/runners/valence_spec.rb +67 -0
- data/spec/legion/extensions/agentic/affect/empathy/client_spec.rb +20 -0
- data/spec/legion/extensions/agentic/affect/empathy/helpers/constants_spec.rb +23 -0
- data/spec/legion/extensions/agentic/affect/empathy/helpers/mental_model_spec.rb +150 -0
- data/spec/legion/extensions/agentic/affect/empathy/helpers/model_store_spec.rb +94 -0
- data/spec/legion/extensions/agentic/affect/empathy/runners/empathy_spec.rb +127 -0
- data/spec/legion/extensions/agentic/affect/fatigue/client_spec.rb +66 -0
- data/spec/legion/extensions/agentic/affect/fatigue/helpers/constants_spec.rb +130 -0
- data/spec/legion/extensions/agentic/affect/fatigue/helpers/energy_model_spec.rb +281 -0
- data/spec/legion/extensions/agentic/affect/fatigue/helpers/fatigue_store_spec.rb +157 -0
- data/spec/legion/extensions/agentic/affect/fatigue/runners/fatigue_spec.rb +127 -0
- data/spec/legion/extensions/agentic/affect/flow/client_spec.rb +58 -0
- data/spec/legion/extensions/agentic/affect/flow/helpers/constants_spec.rb +112 -0
- data/spec/legion/extensions/agentic/affect/flow/helpers/flow_detector_spec.rb +268 -0
- data/spec/legion/extensions/agentic/affect/flow/runners/flow_spec.rb +222 -0
- data/spec/legion/extensions/agentic/affect/interoception/client_spec.rb +52 -0
- data/spec/legion/extensions/agentic/affect/interoception/helpers/body_budget_spec.rb +178 -0
- data/spec/legion/extensions/agentic/affect/interoception/helpers/somatic_marker_spec.rb +120 -0
- data/spec/legion/extensions/agentic/affect/interoception/runners/interoception_spec.rb +108 -0
- data/spec/legion/extensions/agentic/affect/mood/client_spec.rb +20 -0
- data/spec/legion/extensions/agentic/affect/mood/helpers/constants_spec.rb +29 -0
- data/spec/legion/extensions/agentic/affect/mood/helpers/mood_state_spec.rb +94 -0
- data/spec/legion/extensions/agentic/affect/mood/runners/mood_spec.rb +71 -0
- data/spec/legion/extensions/agentic/affect/motivation/client_spec.rb +35 -0
- data/spec/legion/extensions/agentic/affect/motivation/helpers/constants_spec.rb +111 -0
- data/spec/legion/extensions/agentic/affect/motivation/helpers/drive_state_spec.rb +183 -0
- data/spec/legion/extensions/agentic/affect/motivation/helpers/motivation_store_spec.rb +185 -0
- data/spec/legion/extensions/agentic/affect/motivation/runners/motivation_spec.rb +248 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/actors/auto_regulate_spec.rb +46 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/client_spec.rb +64 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/helpers/constants_spec.rb +102 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/helpers/emotional_event_spec.rb +177 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/helpers/llm_enhancer_spec.rb +161 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/helpers/reappraisal_engine_spec.rb +211 -0
- data/spec/legion/extensions/agentic/affect/reappraisal/runners/cognitive_reappraisal_spec.rb +312 -0
- data/spec/legion/extensions/agentic/affect/regulation/client_spec.rb +61 -0
- data/spec/legion/extensions/agentic/affect/regulation/helpers/constants_spec.rb +108 -0
- data/spec/legion/extensions/agentic/affect/regulation/helpers/regulation_model_spec.rb +200 -0
- data/spec/legion/extensions/agentic/affect/regulation/runners/emotional_regulation_spec.rb +190 -0
- data/spec/legion/extensions/agentic/affect/resilience/client_spec.rb +36 -0
- data/spec/legion/extensions/agentic/affect/resilience/helpers/adversity_tracker_spec.rb +164 -0
- data/spec/legion/extensions/agentic/affect/resilience/helpers/constants_spec.rb +78 -0
- data/spec/legion/extensions/agentic/affect/resilience/helpers/resilience_model_spec.rb +133 -0
- data/spec/legion/extensions/agentic/affect/resilience/runners/resilience_spec.rb +150 -0
- data/spec/legion/extensions/agentic/affect/resonance/client_spec.rb +66 -0
- data/spec/legion/extensions/agentic/affect/resonance/cognitive_resonance_spec.rb +27 -0
- data/spec/legion/extensions/agentic/affect/resonance/helpers/category_spec.rb +146 -0
- data/spec/legion/extensions/agentic/affect/resonance/helpers/constants_spec.rb +104 -0
- data/spec/legion/extensions/agentic/affect/resonance/helpers/resonance_engine_spec.rb +189 -0
- data/spec/legion/extensions/agentic/affect/resonance/runners/cognitive_resonance_spec.rb +197 -0
- data/spec/legion/extensions/agentic/affect/reward/client_spec.rb +42 -0
- data/spec/legion/extensions/agentic/affect/reward/helpers/constants_spec.rb +91 -0
- data/spec/legion/extensions/agentic/affect/reward/helpers/reward_signal_spec.rb +296 -0
- data/spec/legion/extensions/agentic/affect/reward/helpers/reward_store_spec.rb +167 -0
- data/spec/legion/extensions/agentic/affect/reward/runners/reward_spec.rb +149 -0
- data/spec/legion/extensions/agentic/affect/somatic_marker/client_spec.rb +83 -0
- data/spec/legion/extensions/agentic/affect/somatic_marker/helpers/body_state_spec.rb +155 -0
- data/spec/legion/extensions/agentic/affect/somatic_marker/helpers/marker_store_spec.rb +233 -0
- data/spec/legion/extensions/agentic/affect/somatic_marker/helpers/somatic_marker_spec.rb +172 -0
- data/spec/legion/extensions/agentic/affect/somatic_marker/runners/somatic_marker_spec.rb +181 -0
- data/spec/spec_helper.rb +46 -0
- metadata +302 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d03176e4d632c5182d79f6c122b06ee6492b7a330ea28f26de0bdf2b38464d3c
|
|
4
|
+
data.tar.gz: 036f318f959c28fd2e4ab3d33b439ac81742b52b406702a56667ad2a78c35f3b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 923827c5b0fae5871187437b4e0ffc7672ff52214ff0261c857c240128c4d1bd5a6dbbbe14b50e3caf22db645cd76e71c7ff490dbb348fd8ab5ed55dac6b4230
|
|
7
|
+
data.tar.gz: e27fe89064ed41221e4879b841830058d759158eda0e7f396cf7acd22252c6c60d5b739ebc7956e3691713c6aaf8f08de0d556a15eadb5eddc1b3340f9f211df
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-03-18
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial release as domain consolidation gem
|
|
9
|
+
- Consolidated source extensions into unified domain gem under `Legion::Extensions::Agentic::<Domain>`
|
|
10
|
+
- All sub-modules loaded from single entry point
|
|
11
|
+
- Full spec suite with zero failures
|
|
12
|
+
- RuboCop compliance across all files
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matthew Iverson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/legion/extensions/agentic/affect/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'lex-agentic-affect'
|
|
7
|
+
spec.version = Legion::Extensions::Agentic::Affect::VERSION
|
|
8
|
+
spec.authors = ['Esity']
|
|
9
|
+
spec.email = ['matthewdiverson@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'LEX Agentic Affect'
|
|
12
|
+
spec.description = 'LEX agentic affect domain: emotions, valence, mood regulation'
|
|
13
|
+
spec.homepage = 'https://github.com/LegionIO/lex-agentic-affect'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.required_ruby_version = '>= 3.4'
|
|
16
|
+
|
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
19
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
20
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
21
|
+
|
|
22
|
+
spec.files = Dir.chdir(__dir__) do
|
|
23
|
+
Dir.glob('{lib,spec}/**/*.rb') + %w[lex-agentic-affect.gemspec Gemfile LICENSE README.md CHANGELOG.md]
|
|
24
|
+
end
|
|
25
|
+
spec.require_paths = ['lib']
|
|
26
|
+
|
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 1.60'
|
|
29
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.26'
|
|
30
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/affect/appraisal/helpers/constants'
|
|
4
|
+
require 'legion/extensions/agentic/affect/appraisal/helpers/appraisal'
|
|
5
|
+
require 'legion/extensions/agentic/affect/appraisal/helpers/appraisal_engine'
|
|
6
|
+
require 'legion/extensions/agentic/affect/appraisal/runners/appraisal'
|
|
7
|
+
|
|
8
|
+
module Legion
|
|
9
|
+
module Extensions
|
|
10
|
+
module Agentic
|
|
11
|
+
module Affect
|
|
12
|
+
module Appraisal
|
|
13
|
+
class Client
|
|
14
|
+
include Runners::Appraisal
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Agentic
|
|
8
|
+
module Affect
|
|
9
|
+
module Appraisal
|
|
10
|
+
module Helpers
|
|
11
|
+
class Appraisal
|
|
12
|
+
include Constants
|
|
13
|
+
|
|
14
|
+
attr_reader :id, :event, :domain, :primary, :secondary,
|
|
15
|
+
:emotional_outcome, :intensity, :coping_strategy,
|
|
16
|
+
:reappraised, :created_at, :reappraised_at
|
|
17
|
+
|
|
18
|
+
def initialize(event:, primary:, secondary:, domain: nil)
|
|
19
|
+
@id = SecureRandom.uuid
|
|
20
|
+
@event = event
|
|
21
|
+
@domain = domain
|
|
22
|
+
@primary = normalize_dimensions(primary, PRIMARY_DIMENSIONS)
|
|
23
|
+
@secondary = normalize_dimensions(secondary, SECONDARY_DIMENSIONS)
|
|
24
|
+
@intensity = DEFAULT_INTENSITY
|
|
25
|
+
@coping_strategy = nil
|
|
26
|
+
@reappraised = false
|
|
27
|
+
@created_at = Time.now.utc
|
|
28
|
+
@reappraised_at = nil
|
|
29
|
+
@emotional_outcome = compute_emotion
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def reappraise(new_primary:, new_secondary:)
|
|
33
|
+
@primary = normalize_dimensions(new_primary, PRIMARY_DIMENSIONS)
|
|
34
|
+
@secondary = normalize_dimensions(new_secondary, SECONDARY_DIMENSIONS)
|
|
35
|
+
@emotional_outcome = compute_emotion
|
|
36
|
+
@intensity = (@intensity * (1 - REAPPRAISAL_DISCOUNT)).clamp(INTENSITY_FLOOR, INTENSITY_CEILING)
|
|
37
|
+
@reappraised = true
|
|
38
|
+
@reappraised_at = Time.now.utc
|
|
39
|
+
self
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def compute_emotion
|
|
43
|
+
relevance = @primary[:relevance]
|
|
44
|
+
goal_congruence = @primary[:goal_congruence]
|
|
45
|
+
coping_potential = @secondary[:coping_potential]
|
|
46
|
+
|
|
47
|
+
return :indifference if relevance < 0.3
|
|
48
|
+
|
|
49
|
+
classify_emotion(goal_congruence, coping_potential)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def to_h
|
|
53
|
+
{
|
|
54
|
+
id: @id,
|
|
55
|
+
event: @event,
|
|
56
|
+
domain: @domain,
|
|
57
|
+
primary: @primary,
|
|
58
|
+
secondary: @secondary,
|
|
59
|
+
emotional_outcome: @emotional_outcome,
|
|
60
|
+
intensity: @intensity,
|
|
61
|
+
coping_strategy: @coping_strategy,
|
|
62
|
+
reappraised: @reappraised,
|
|
63
|
+
created_at: @created_at,
|
|
64
|
+
reappraised_at: @reappraised_at
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def assign_coping(strategy_name)
|
|
69
|
+
@coping_strategy = strategy_name
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def decay!
|
|
73
|
+
@intensity = (@intensity - DECAY_RATE).clamp(INTENSITY_FLOOR, INTENSITY_CEILING)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def classify_emotion(goal_congruence, coping_potential)
|
|
79
|
+
if goal_congruence < 0.4
|
|
80
|
+
low_congruence_emotion(goal_congruence, coping_potential)
|
|
81
|
+
elsif goal_congruence > 0.7
|
|
82
|
+
:joy
|
|
83
|
+
else
|
|
84
|
+
:sadness
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def low_congruence_emotion(goal_congruence, coping_potential)
|
|
89
|
+
if goal_congruence < 0.3
|
|
90
|
+
:anger
|
|
91
|
+
elsif coping_potential < 0.4
|
|
92
|
+
:anxiety
|
|
93
|
+
elsif coping_potential >= 0.6
|
|
94
|
+
:challenge
|
|
95
|
+
else
|
|
96
|
+
:sadness
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def normalize_dimensions(raw, dimensions)
|
|
101
|
+
dimensions.to_h do |dim|
|
|
102
|
+
val = raw.fetch(dim, 0.0).to_f
|
|
103
|
+
[dim, val.clamp(INTENSITY_FLOOR, INTENSITY_CEILING)]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Affect
|
|
7
|
+
module Appraisal
|
|
8
|
+
module Helpers
|
|
9
|
+
class AppraisalEngine
|
|
10
|
+
include Constants
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@appraisals = {}
|
|
14
|
+
@coping_strategies = {}
|
|
15
|
+
@history = []
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def appraise(event:, primary:, secondary:, domain: nil)
|
|
19
|
+
record = Appraisal.new(event: event, primary: primary, secondary: secondary, domain: domain)
|
|
20
|
+
prune_appraisals if @appraisals.size >= MAX_APPRAISALS
|
|
21
|
+
@appraisals[record.id] = record
|
|
22
|
+
archive(record)
|
|
23
|
+
record
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def reappraise(appraisal_id:, new_primary:, new_secondary:)
|
|
27
|
+
record = @appraisals[appraisal_id]
|
|
28
|
+
return nil unless record
|
|
29
|
+
|
|
30
|
+
record.reappraise(new_primary: new_primary, new_secondary: new_secondary)
|
|
31
|
+
archive(record)
|
|
32
|
+
record
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def select_coping(appraisal_id:, coping_type:)
|
|
36
|
+
record = @appraisals[appraisal_id]
|
|
37
|
+
return nil unless record
|
|
38
|
+
|
|
39
|
+
strategy = find_best_strategy(coping_type)
|
|
40
|
+
name = strategy ? strategy[:name] : coping_type.to_s
|
|
41
|
+
record.assign_coping(name)
|
|
42
|
+
record
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def add_coping_strategy(name:, coping_type:, effectiveness:)
|
|
46
|
+
return false if @coping_strategies.size >= MAX_COPING_STRATEGIES
|
|
47
|
+
|
|
48
|
+
@coping_strategies[name] = {
|
|
49
|
+
name: name,
|
|
50
|
+
coping_type: coping_type,
|
|
51
|
+
effectiveness: effectiveness.to_f.clamp(INTENSITY_FLOOR, INTENSITY_CEILING)
|
|
52
|
+
}
|
|
53
|
+
true
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def evaluate_coping(appraisal_id:)
|
|
57
|
+
record = @appraisals[appraisal_id]
|
|
58
|
+
return { effectiveness: 0.0, resolved: false } unless record
|
|
59
|
+
return { effectiveness: 0.0, resolved: false } unless record.coping_strategy
|
|
60
|
+
|
|
61
|
+
strategy = @coping_strategies[record.coping_strategy]
|
|
62
|
+
base = strategy ? strategy[:effectiveness] : DEFAULT_INTENSITY
|
|
63
|
+
resolved = record.intensity < 0.3
|
|
64
|
+
{
|
|
65
|
+
appraisal_id: appraisal_id,
|
|
66
|
+
coping: record.coping_strategy,
|
|
67
|
+
effectiveness: base,
|
|
68
|
+
intensity: record.intensity,
|
|
69
|
+
resolved: resolved
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def by_emotion(emotion:)
|
|
74
|
+
@appraisals.values.select { |rec| rec.emotional_outcome == emotion }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def by_domain(domain:)
|
|
78
|
+
@appraisals.values.select { |rec| rec.domain == domain }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def unresolved
|
|
82
|
+
@appraisals.values.select { |rec| rec.coping_strategy.nil? }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def emotional_pattern
|
|
86
|
+
counts = Hash.new(0)
|
|
87
|
+
recent_appraisals.each { |rec| counts[rec.emotional_outcome] += 1 }
|
|
88
|
+
counts.sort_by { |_, cnt| -cnt }.to_h
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def decay_all
|
|
92
|
+
@appraisals.each_value(&:decay!)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def to_h
|
|
96
|
+
{
|
|
97
|
+
appraisals: @appraisals.transform_values(&:to_h),
|
|
98
|
+
coping_strategies: @coping_strategies,
|
|
99
|
+
history_size: @history.size
|
|
100
|
+
}
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
private
|
|
104
|
+
|
|
105
|
+
def archive(record)
|
|
106
|
+
@history << { id: record.id, emotion: record.emotional_outcome, at: Time.now.utc }
|
|
107
|
+
@history.shift while @history.size > MAX_HISTORY
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def prune_appraisals
|
|
111
|
+
oldest_key = @appraisals.min_by { |_, rec| rec.created_at }&.first
|
|
112
|
+
@appraisals.delete(oldest_key) if oldest_key
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def find_best_strategy(coping_type)
|
|
116
|
+
matches = @coping_strategies.values.select { |str| str[:coping_type] == coping_type }
|
|
117
|
+
matches.max_by { |str| str[:effectiveness] }
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def recent_appraisals
|
|
121
|
+
@appraisals.values.last(50)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Affect
|
|
7
|
+
module Appraisal
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
MAX_APPRAISALS = 200
|
|
11
|
+
MAX_COPING_STRATEGIES = 50
|
|
12
|
+
MAX_HISTORY = 300
|
|
13
|
+
|
|
14
|
+
DEFAULT_INTENSITY = 0.5
|
|
15
|
+
INTENSITY_FLOOR = 0.0
|
|
16
|
+
INTENSITY_CEILING = 1.0
|
|
17
|
+
|
|
18
|
+
DECAY_RATE = 0.02
|
|
19
|
+
REAPPRAISAL_DISCOUNT = 0.3
|
|
20
|
+
|
|
21
|
+
PRIMARY_DIMENSIONS = %i[relevance goal_congruence goal_importance].freeze
|
|
22
|
+
|
|
23
|
+
SECONDARY_DIMENSIONS = %i[coping_potential control_expectation future_expectancy].freeze
|
|
24
|
+
|
|
25
|
+
APPRAISAL_EMOTIONS = {
|
|
26
|
+
threat_low_coping: :anxiety,
|
|
27
|
+
threat_high_coping: :challenge,
|
|
28
|
+
loss: :sadness,
|
|
29
|
+
goal_incongruent: :anger,
|
|
30
|
+
goal_congruent: :joy,
|
|
31
|
+
irrelevant: :indifference,
|
|
32
|
+
unexpected_positive: :surprise,
|
|
33
|
+
moral_violation: :disgust
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
36
|
+
COPING_TYPES = %i[problem_focused emotion_focused meaning_focused avoidant social_support].freeze
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Affect
|
|
7
|
+
module Appraisal
|
|
8
|
+
module Runners
|
|
9
|
+
module Appraisal
|
|
10
|
+
def appraise_event(event:, primary:, secondary:, domain: nil, **)
|
|
11
|
+
Legion::Logging.debug("[lex-appraisal] appraise_event event=#{event} domain=#{domain}")
|
|
12
|
+
record = engine.appraise(event: event, primary: primary, secondary: secondary, domain: domain)
|
|
13
|
+
{ success: true, appraisal: record.to_h }
|
|
14
|
+
rescue StandardError => e
|
|
15
|
+
Legion::Logging.error("[lex-appraisal] appraise_event error: #{e.message}")
|
|
16
|
+
{ success: false, error: e.message }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def reappraise_event(appraisal_id:, new_primary:, new_secondary:, **)
|
|
20
|
+
Legion::Logging.debug("[lex-appraisal] reappraise_event id=#{appraisal_id}")
|
|
21
|
+
record = engine.reappraise(appraisal_id: appraisal_id, new_primary: new_primary,
|
|
22
|
+
new_secondary: new_secondary)
|
|
23
|
+
return { success: false, error: 'appraisal not found' } unless record
|
|
24
|
+
|
|
25
|
+
{ success: true, appraisal: record.to_h }
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
Legion::Logging.error("[lex-appraisal] reappraise_event error: #{e.message}")
|
|
28
|
+
{ success: false, error: e.message }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def select_coping_strategy(appraisal_id:, coping_type:, **)
|
|
32
|
+
Legion::Logging.debug("[lex-appraisal] select_coping appraisal_id=#{appraisal_id}")
|
|
33
|
+
record = engine.select_coping(appraisal_id: appraisal_id, coping_type: coping_type)
|
|
34
|
+
return { success: false, error: 'appraisal not found' } unless record
|
|
35
|
+
|
|
36
|
+
{ success: true, appraisal: record.to_h }
|
|
37
|
+
rescue StandardError => e
|
|
38
|
+
Legion::Logging.error("[lex-appraisal] select_coping error: #{e.message}")
|
|
39
|
+
{ success: false, error: e.message }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def add_coping_strategy(name:, coping_type:, effectiveness:, **)
|
|
43
|
+
Legion::Logging.debug("[lex-appraisal] add_coping_strategy name=#{name}")
|
|
44
|
+
added = engine.add_coping_strategy(name: name, coping_type: coping_type, effectiveness: effectiveness)
|
|
45
|
+
{ success: added, name: name, coping_type: coping_type }
|
|
46
|
+
rescue StandardError => e
|
|
47
|
+
Legion::Logging.error("[lex-appraisal] add_coping_strategy error: #{e.message}")
|
|
48
|
+
{ success: false, error: e.message }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def evaluate_coping(appraisal_id:, **)
|
|
52
|
+
Legion::Logging.debug("[lex-appraisal] evaluate_coping id=#{appraisal_id}")
|
|
53
|
+
result = engine.evaluate_coping(appraisal_id: appraisal_id)
|
|
54
|
+
{ success: true }.merge(result)
|
|
55
|
+
rescue StandardError => e
|
|
56
|
+
Legion::Logging.error("[lex-appraisal] evaluate_coping error: #{e.message}")
|
|
57
|
+
{ success: false, error: e.message }
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def emotional_pattern(**)
|
|
61
|
+
Legion::Logging.debug('[lex-appraisal] emotional_pattern')
|
|
62
|
+
pattern = engine.emotional_pattern
|
|
63
|
+
{ success: true, pattern: pattern }
|
|
64
|
+
rescue StandardError => e
|
|
65
|
+
Legion::Logging.error("[lex-appraisal] emotional_pattern error: #{e.message}")
|
|
66
|
+
{ success: false, error: e.message }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def update_appraisal(**)
|
|
70
|
+
Legion::Logging.debug('[lex-appraisal] update_appraisal (decay cycle)')
|
|
71
|
+
engine.decay_all
|
|
72
|
+
{ success: true }
|
|
73
|
+
rescue StandardError => e
|
|
74
|
+
Legion::Logging.error("[lex-appraisal] update_appraisal error: #{e.message}")
|
|
75
|
+
{ success: false, error: e.message }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def appraisal_stats(**)
|
|
79
|
+
Legion::Logging.debug('[lex-appraisal] appraisal_stats')
|
|
80
|
+
data = engine.to_h
|
|
81
|
+
unresolved = engine.unresolved.size
|
|
82
|
+
{
|
|
83
|
+
success: true,
|
|
84
|
+
total: data[:appraisals].size,
|
|
85
|
+
unresolved: unresolved,
|
|
86
|
+
history_size: data[:history_size],
|
|
87
|
+
pattern: engine.emotional_pattern
|
|
88
|
+
}
|
|
89
|
+
rescue StandardError => e
|
|
90
|
+
Legion::Logging.error("[lex-appraisal] appraisal_stats error: #{e.message}")
|
|
91
|
+
{ success: false, error: e.message }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
def engine
|
|
97
|
+
@engine ||= Helpers::AppraisalEngine.new
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/agentic/affect/appraisal/version'
|
|
4
|
+
require 'legion/extensions/agentic/affect/appraisal/helpers/constants'
|
|
5
|
+
require 'legion/extensions/agentic/affect/appraisal/helpers/appraisal'
|
|
6
|
+
require 'legion/extensions/agentic/affect/appraisal/helpers/appraisal_engine'
|
|
7
|
+
require 'legion/extensions/agentic/affect/appraisal/runners/appraisal'
|
|
8
|
+
require 'legion/extensions/agentic/affect/appraisal/client'
|
|
9
|
+
|
|
10
|
+
module Legion
|
|
11
|
+
module Extensions
|
|
12
|
+
module Agentic
|
|
13
|
+
module Affect
|
|
14
|
+
module Appraisal
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Affect
|
|
7
|
+
module CognitiveEmpathy
|
|
8
|
+
class Client
|
|
9
|
+
include Runners::CognitiveEmpathy
|
|
10
|
+
|
|
11
|
+
def initialize(engine: nil)
|
|
12
|
+
@engine = engine || Helpers::EmpathyEngine.new
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Agentic
|
|
6
|
+
module Affect
|
|
7
|
+
module CognitiveEmpathy
|
|
8
|
+
module Helpers
|
|
9
|
+
module Constants
|
|
10
|
+
MAX_PERSPECTIVES = 50
|
|
11
|
+
MAX_INTERACTIONS = 200
|
|
12
|
+
MAX_HISTORY = 200
|
|
13
|
+
|
|
14
|
+
DEFAULT_ACCURACY = 0.5
|
|
15
|
+
ACCURACY_FLOOR = 0.1
|
|
16
|
+
ACCURACY_CEILING = 0.95
|
|
17
|
+
CONTAGION_RATE = 0.15
|
|
18
|
+
CONTAGION_DECAY = 0.05
|
|
19
|
+
ACCURACY_ALPHA = 0.1
|
|
20
|
+
|
|
21
|
+
PERSPECTIVE_TYPES = %i[cognitive affective motivational situational].freeze
|
|
22
|
+
EMPATHIC_STATES = %i[detached observing resonating immersed].freeze
|
|
23
|
+
|
|
24
|
+
ACCURACY_LABELS = {
|
|
25
|
+
(0.8..) => :excellent,
|
|
26
|
+
(0.6...0.8) => :good,
|
|
27
|
+
(0.4...0.6) => :moderate,
|
|
28
|
+
(0.2...0.4) => :poor,
|
|
29
|
+
(..0.2) => :blind
|
|
30
|
+
}.freeze
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|