lex-agentic-affect 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ec4f55a27e83dc8b2603bbef89c51eb709c615b7d3c982775289389caa714b0
4
- data.tar.gz: 9e5234c0065bfadcfed6bfde54d1d126ca7c2994467c93ecfaed1478a564fb3d
3
+ metadata.gz: 64e47fe3d5e4b6c59bb58ed12d8acf1c1888e1668e4fe164a69461911050afff
4
+ data.tar.gz: 5d95cdf190ff874aaa8c46e184e079d73849b76891ec0138ef54fd40ac912b75
5
5
  SHA512:
6
- metadata.gz: 188baa2428214f04dc709bd5e71473cd5c311428adaaa1ec99d3698f108968a09a5bd539068e624b09bed618f3324d4b0ad65ab50c0dce01cd4e94d6156d75aa
7
- data.tar.gz: ad11e007b762a6fd92afa2f957c7981c3156e2d5c13764ead4a7df0fc5ad8396029a011db78c7a9ae03651432bf15bfa2b1b42269ef012ec14f0ca0f6832641c
6
+ metadata.gz: 8ec5b239a2ed5f20ebfa28c0c5e9c2e19032b2a474aa1fe3d4583e1c34092fcbee3673df7433460b5fdf67f1b562c7f253f261219ada523a0f349eb58941cc70
7
+ data.tar.gz: df01ac0b9ea74775059fde392e081f0b97a793a95d76b0011930d428b78f667482c3a77a97cf7c276a3c1dd6684e45419fb66b33c6ff4c435c70c1d6a43461f5
data/README.md CHANGED
@@ -1,13 +1,56 @@
1
1
  # lex-agentic-affect
2
2
 
3
- LEX agentic affect domain: emotions, valence, mood regulation
3
+ Domain consolidation gem for emotion, affect, and motivational processing. Bundles 17 source extensions into one loadable unit under `Legion::Extensions::Agentic::Affect`.
4
4
 
5
- ## Sub-modules
5
+ ## Overview
6
6
 
7
- *(populated as extensions are consolidated)*
7
+ **Gem**: `lex-agentic-affect`
8
+ **Version**: 0.1.1
9
+ **Namespace**: `Legion::Extensions::Agentic::Affect`
10
+
11
+ ## Sub-Modules
12
+
13
+ | Sub-Module | Source Gem | Purpose |
14
+ |---|---|---|
15
+ | `Affect::Emotion` | `lex-emotion` | Four-dimensional emotional valence/arousal, EMA momentum, gut instinct |
16
+ | `Affect::Mood` | `lex-mood` | Background mood baseline distinct from discrete emotions |
17
+ | `Affect::Appraisal` | `lex-appraisal` | Lazarus appraisal theory — primary/secondary appraisal of events |
18
+ | `Affect::CognitiveEmpathy` | `lex-cognitive-empathy` | Cognitive empathy processing |
19
+ | `Affect::Empathy` | `lex-empathy` | Affective and cognitive empathy |
20
+ | `Affect::Reappraisal` | `lex-cognitive-reappraisal` | Gross process model — six emotion regulation strategies |
21
+ | `Affect::Regulation` | `lex-emotional-regulation` | Regulation strategy selection and effectiveness tracking |
22
+ | `Affect::Defusion` | `lex-cognitive-defusion` | ACT-style cognitive defusion from difficult thoughts |
23
+ | `Affect::Contagion` | `lex-cognitive-contagion` | Emotional contagion spread across agent interactions |
24
+ | `Affect::SomaticMarker` | `lex-somatic-marker` | Damasio somatic marker hypothesis — gut-feeling tagging |
25
+ | `Affect::Interoception` | `lex-interoception` | Internal body state signals (fatigue, tension, arousal) |
26
+ | `Affect::Flow` | `lex-flow` | Csikszentmihalyi flow state |
27
+ | `Affect::Fatigue` | `lex-fatigue` | Mental fatigue accumulation and recovery modeling |
28
+ | `Affect::Motivation` | `lex-motivation` | Drive states — homeostatic and intrinsic motivation |
29
+ | `Affect::Reward` | `lex-reward` | Reward signal computation and prediction error |
30
+ | `Affect::Resilience` | `lex-resilience` | Recovery capacity and stress inoculation |
31
+ | `Affect::Resonance` | `lex-cognitive-resonance` | Affective resonance patterns |
32
+
33
+ ## Actors
34
+
35
+ - `Affect::Emotion::Actors::MomentumDecay` — runs every 60s, decays emotional momentum via `decay_momentum`
36
+ - `Affect::Interoception::Actors::Decay` — interval actor, decays interoceptive body state signals
37
+ - `Affect::Reappraisal::Actors::AutoRegulate` — runs every 300s, processes pending emotional events
38
+ - `Affect::SomaticMarker::Actors::Decay` — interval actor, decays somatic marker strength
8
39
 
9
40
  ## Installation
10
41
 
11
42
  ```ruby
12
43
  gem 'lex-agentic-affect'
13
44
  ```
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ bundle install
50
+ bundle exec rspec # 1523 examples, 0 failures
51
+ bundle exec rubocop # 0 offenses
52
+ ```
53
+
54
+ ## License
55
+
56
+ MIT
@@ -72,6 +72,18 @@ module Legion
72
72
  { arousal: arousal }
73
73
  end
74
74
 
75
+ def raise_urgency_for_knowledge_vulnerability(domains_at_risk:, severity: :warning, urgency_boost: 0.3, **)
76
+ boost = severity.to_sym == :critical ? [urgency_boost * 1.5, 1.0].min : urgency_boost.to_f
77
+ signal = { urgency_hint: boost, domain_weight: 0.6, impact_scope: 0.5,
78
+ outcome_severity: boost, novelty_score: 0.3 }
79
+ result = evaluate_valence(signal: signal, source_type: :mesh_priority)
80
+
81
+ Legion::Logging.info "[emotion] knowledge_vulnerability urgency raised: domains=#{Array(domains_at_risk).join(',')} " \
82
+ "severity=#{severity} boost=#{boost.round(2)} urgency=#{result[:valence][:urgency].round(2)}"
83
+
84
+ result.merge(event: :knowledge_vulnerability, domains_at_risk: Array(domains_at_risk), urgency_boost: boost)
85
+ end
86
+
75
87
  private
76
88
 
77
89
  def emotion_baseline
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Affect
7
- VERSION = '0.1.1'
7
+ VERSION = '0.1.2'
8
8
  end
9
9
  end
10
10
  end
@@ -64,4 +64,39 @@ RSpec.describe Legion::Extensions::Agentic::Affect::Emotion::Runners::Valence do
64
64
  expect(result[:arousal]).to be > 0.0
65
65
  end
66
66
  end
67
+
68
+ describe '#raise_urgency_for_knowledge_vulnerability' do
69
+ it 'returns a valence result with event tag' do
70
+ result = client.raise_urgency_for_knowledge_vulnerability(domains_at_risk: %w[pki vault])
71
+ expect(result[:event]).to eq(:knowledge_vulnerability)
72
+ expect(result[:domains_at_risk]).to eq(%w[pki vault])
73
+ end
74
+
75
+ it 'includes urgency_boost in the result' do
76
+ result = client.raise_urgency_for_knowledge_vulnerability(domains_at_risk: ['pki'])
77
+ expect(result[:urgency_boost]).to be > 0.0
78
+ end
79
+
80
+ it 'raises urgency higher for critical severity than warning' do
81
+ warning = client.raise_urgency_for_knowledge_vulnerability(
82
+ domains_at_risk: ['pki'], severity: :warning
83
+ )
84
+ critical = client.raise_urgency_for_knowledge_vulnerability(
85
+ domains_at_risk: ['pki'], severity: :critical
86
+ )
87
+ expect(critical[:urgency_boost]).to be > warning[:urgency_boost]
88
+ end
89
+
90
+ it 'returns a valence hash with all four dimensions' do
91
+ result = client.raise_urgency_for_knowledge_vulnerability(domains_at_risk: ['dns'])
92
+ expect(result[:valence].keys).to contain_exactly(:urgency, :importance, :novelty, :familiarity)
93
+ end
94
+
95
+ it 'accepts a custom urgency_boost' do
96
+ result = client.raise_urgency_for_knowledge_vulnerability(
97
+ domains_at_risk: ['ssh'], urgency_boost: 0.5
98
+ )
99
+ expect(result[:urgency_boost]).to be_within(0.01).of(0.5)
100
+ end
101
+ end
67
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-affect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity