lex-agentic-affect 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/legion/extensions/agentic/affect/appraisal/helpers/appraisal_engine.rb +1 -0
- data/lib/legion/extensions/agentic/affect/appraisal/version.rb +1 -1
- data/lib/legion/extensions/agentic/affect/interoception/helpers/body_budget.rb +2 -0
- data/lib/legion/extensions/agentic/affect/interoception/runners/interoception.rb +2 -0
- data/lib/legion/extensions/agentic/affect/interoception/version.rb +1 -1
- data/lib/legion/extensions/agentic/affect/version.rb +1 -1
- data/spec/legion/extensions/agentic/affect/appraisal/helpers/appraisal_engine_spec.rb +13 -0
- data/spec/legion/extensions/agentic/affect/interoception/helpers/body_budget_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ec4f55a27e83dc8b2603bbef89c51eb709c615b7d3c982775289389caa714b0
|
|
4
|
+
data.tar.gz: 9e5234c0065bfadcfed6bfde54d1d126ca7c2994467c93ecfaed1478a564fb3d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 188baa2428214f04dc709bd5e71473cd5c311428adaaa1ec99d3698f108968a09a5bd539068e624b09bed618f3324d4b0ad65ab50c0dce01cd4e94d6156d75aa
|
|
7
|
+
data.tar.gz: ad11e007b762a6fd92afa2f957c7981c3156e2d5c13764ead4a7df0fc5ad8396029a011db78c7a9ae03651432bf15bfa2b1b42269ef012ec14f0ca0f6832641c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [0.1.1] - 2026-03-18
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Validate `channel` against `VITAL_CHANNELS` in `Interoception::BodyBudget#report_vital` — rejects unknown channel keys
|
|
7
|
+
- Validate `coping_type` against `COPING_TYPES` in `Appraisal::AppraisalEngine#add_coping_strategy` — rejects invalid coping types
|
|
4
8
|
|
|
5
9
|
## [0.1.0] - 2026-03-18
|
|
6
10
|
|
|
@@ -22,6 +22,8 @@ module Legion
|
|
|
22
22
|
|
|
23
23
|
def report_vital(channel:, value:)
|
|
24
24
|
channel = channel.to_sym
|
|
25
|
+
return nil unless VITAL_CHANNELS.include?(channel)
|
|
26
|
+
|
|
25
27
|
normalized = value.clamp(0.0, 1.0)
|
|
26
28
|
@baselines[channel] ||= DEFAULT_BASELINE
|
|
27
29
|
@vitals[channel] = if @vitals.key?(channel)
|
|
@@ -12,6 +12,8 @@ module Legion
|
|
|
12
12
|
|
|
13
13
|
def report_vital(channel:, value:, **)
|
|
14
14
|
smoothed = body_budget.report_vital(channel: channel, value: value.to_f)
|
|
15
|
+
return { success: false, error: :invalid_channel, valid_channels: Helpers::Constants::VITAL_CHANNELS } unless smoothed
|
|
16
|
+
|
|
15
17
|
deviation = body_budget.deviation_for(channel)
|
|
16
18
|
Legion::Logging.debug "[interoception] vital: channel=#{channel} raw=#{value} " \
|
|
17
19
|
"smoothed=#{smoothed.round(3)} deviation=#{deviation.round(3)}"
|
|
@@ -73,6 +73,19 @@ RSpec.describe Legion::Extensions::Agentic::Affect::Appraisal::Helpers::Appraisa
|
|
|
73
73
|
# Strategy stored (engine is internal, test via evaluate_coping behavior)
|
|
74
74
|
expect(data).to be_a(Hash)
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
it 'rejects invalid coping_type' do
|
|
78
|
+
result = engine.add_coping_strategy(name: 'wishful', coping_type: :wishful_thinking, effectiveness: 0.5)
|
|
79
|
+
expect(result).to be(false)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'accepts all valid COPING_TYPES' do
|
|
83
|
+
constants = Legion::Extensions::Agentic::Affect::Appraisal::Helpers::Constants
|
|
84
|
+
constants::COPING_TYPES.each_with_index do |ct, i|
|
|
85
|
+
result = engine.add_coping_strategy(name: "strategy_#{i}", coping_type: ct, effectiveness: 0.5)
|
|
86
|
+
expect(result).to be(true)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
76
89
|
end
|
|
77
90
|
|
|
78
91
|
describe '#evaluate_coping' do
|
|
@@ -26,6 +26,18 @@ RSpec.describe Legion::Extensions::Agentic::Affect::Interoception::Helpers::Body
|
|
|
26
26
|
10.times { budget.report_vital(channel: :cpu_load, value: 0.9) }
|
|
27
27
|
expect(budget.baselines[:cpu_load]).to be > 0.5
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
it 'rejects invalid channels' do
|
|
31
|
+
expect(budget.report_vital(channel: :bogus_channel, value: 0.5)).to be_nil
|
|
32
|
+
expect(budget.channel_count).to eq(0)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'accepts all valid VITAL_CHANNELS' do
|
|
36
|
+
constants = Legion::Extensions::Agentic::Affect::Interoception::Helpers::Constants
|
|
37
|
+
constants::VITAL_CHANNELS.each do |ch|
|
|
38
|
+
expect(budget.report_vital(channel: ch, value: 0.5)).to be_a(Float)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
29
41
|
end
|
|
30
42
|
|
|
31
43
|
describe '#deviation_for' do
|