lex-agentic-defense 0.1.11 → 0.1.12
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 +4 -0
- data/README.md +1 -1
- data/lib/legion/extensions/agentic/defense/bias/actors/update.rb +1 -1
- data/lib/legion/extensions/agentic/defense/bias/helpers/bias_detector.rb +5 -5
- data/lib/legion/extensions/agentic/defense/bias/runners/bias.rb +5 -8
- data/lib/legion/extensions/agentic/defense/confabulation/actors/decay.rb +1 -1
- data/lib/legion/extensions/agentic/defense/dissonance/actors/update.rb +1 -1
- data/lib/legion/extensions/agentic/defense/epistemic_vigilance/actors/update.rb +1 -1
- data/lib/legion/extensions/agentic/defense/erosion/actors/weather.rb +1 -1
- data/lib/legion/extensions/agentic/defense/error_monitoring/actors/tick.rb +1 -1
- data/lib/legion/extensions/agentic/defense/extinction/actors/protocol_monitor.rb +1 -1
- data/lib/legion/extensions/agentic/defense/extinction/helpers/protocol_state.rb +1 -1
- data/lib/legion/extensions/agentic/defense/immune_response/actors/decay.rb +1 -1
- data/lib/legion/extensions/agentic/defense/immunology/actors/decay.rb +1 -1
- data/lib/legion/extensions/agentic/defense/phantom/actors/decay.rb +1 -1
- data/lib/legion/extensions/agentic/defense/version.rb +1 -1
- data/lib/legion/extensions/agentic/defense/whirlpool/actors/tick.rb +1 -1
- data/spec/legion/extensions/agentic/defense/extinction/helpers/protocol_state_spec.rb +17 -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: fcb5bd36c560fb303cc5202bbc7e7a514a3c91abfdf89e5aa67b8b729fa12296
|
|
4
|
+
data.tar.gz: e07391192c89599fe0669cd64af8d306b85e615d01b5116236ba46e417c1d315
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99f45a52a92e00107a994772e79f7879d693bd26415164d1aa06ea6ea4d2b0bd8c0bb211d12fce2e56da007b042beea776fbdb27839409770076062e3aa5e97a
|
|
7
|
+
data.tar.gz: 699cb22124f3be046b91af9ec37efb7c280bfda1d3297107be007e0d797ed2c05b1752073393f3092738d73435a0f9774188f3ba9c6eeeaacb6cff015e72ab42
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.12] - 2026-10-29
|
|
4
|
+
### Fixed
|
|
5
|
+
- Reject negative, fractional, missing, and nonnumeric extinction de-escalation targets without releasing containment or mutating protocol history.
|
|
6
|
+
|
|
3
7
|
## [0.1.11] - 2026-06-01
|
|
4
8
|
### Fixed
|
|
5
9
|
- Extinction sub-module `VERSION` corrected from `0.2.0` to `0.1.0` — aligns with sibling sub-modules.
|
data/README.md
CHANGED
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Bias
|
|
10
10
|
module Actor
|
|
11
|
-
class Update < Legion::Extensions::Actors::Every
|
|
11
|
+
class Update < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Bias::Runners::Bias
|
|
14
14
|
end
|
|
@@ -13,7 +13,7 @@ module Legion
|
|
|
13
13
|
@susceptibility = Constants::BIAS_TYPES.to_h { |b| [b, Constants::DEFAULT_SUSCEPTIBILITY] }
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def detect_anchoring(current_value:, anchor_value
|
|
16
|
+
def detect_anchoring(current_value:, anchor_value:)
|
|
17
17
|
return 0.0 if anchor_value.nil? || anchor_value.zero?
|
|
18
18
|
|
|
19
19
|
distance = (current_value - anchor_value).abs.to_f / anchor_value.abs
|
|
@@ -23,7 +23,7 @@ module Legion
|
|
|
23
23
|
magnitude.clamp(0.0, 1.0)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
def detect_confirmation(evidence_direction:, hypothesis_direction
|
|
26
|
+
def detect_confirmation(evidence_direction:, hypothesis_direction:)
|
|
27
27
|
magnitude = if evidence_direction == hypothesis_direction
|
|
28
28
|
Constants::CONFIRMATION_WEIGHT * susceptibility_for(:confirmation)
|
|
29
29
|
else
|
|
@@ -33,7 +33,7 @@ module Legion
|
|
|
33
33
|
magnitude.clamp(0.0, 1.0)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def detect_availability(recent_events
|
|
36
|
+
def detect_availability(recent_events:)
|
|
37
37
|
window = Constants::AVAILABILITY_RECENCY_WINDOW
|
|
38
38
|
density = [recent_events.size, window].min.to_f / window
|
|
39
39
|
magnitude = density * susceptibility_for(:availability)
|
|
@@ -41,7 +41,7 @@ module Legion
|
|
|
41
41
|
magnitude.clamp(0.0, 1.0)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def detect_recency(data_points
|
|
44
|
+
def detect_recency(data_points:)
|
|
45
45
|
return 0.0 if data_points.size < 2
|
|
46
46
|
|
|
47
47
|
total = data_points.size
|
|
@@ -61,7 +61,7 @@ module Legion
|
|
|
61
61
|
magnitude.clamp(0.0, 1.0)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
def detect_sunk_cost(invested:, expected_return
|
|
64
|
+
def detect_sunk_cost(invested:, expected_return:)
|
|
65
65
|
return 0.0 if invested <= 0
|
|
66
66
|
|
|
67
67
|
ratio = invested.to_f / (invested + expected_return.abs + 1.0)
|
|
@@ -77,8 +77,7 @@ module Legion
|
|
|
77
77
|
|
|
78
78
|
mag = bias_detector.detect_anchoring(
|
|
79
79
|
current_value: ctx[:current_value],
|
|
80
|
-
anchor_value: anchor_value
|
|
81
|
-
domain: domain
|
|
80
|
+
anchor_value: anchor_value
|
|
82
81
|
)
|
|
83
82
|
[build_bias_result(:anchoring, domain, mag, ctx)]
|
|
84
83
|
end
|
|
@@ -88,8 +87,7 @@ module Legion
|
|
|
88
87
|
|
|
89
88
|
mag = bias_detector.detect_confirmation(
|
|
90
89
|
evidence_direction: ctx[:evidence_direction],
|
|
91
|
-
hypothesis_direction: ctx[:hypothesis_direction]
|
|
92
|
-
domain: domain
|
|
90
|
+
hypothesis_direction: ctx[:hypothesis_direction]
|
|
93
91
|
)
|
|
94
92
|
[build_bias_result(:confirmation, domain, mag, ctx)]
|
|
95
93
|
end
|
|
@@ -97,14 +95,14 @@ module Legion
|
|
|
97
95
|
def detect_availability_bias(domain, ctx)
|
|
98
96
|
return [] unless ctx[:recent_events] # rubocop:disable Legion/Extension/RunnerReturnHash
|
|
99
97
|
|
|
100
|
-
mag = bias_detector.detect_availability(recent_events: ctx[:recent_events]
|
|
98
|
+
mag = bias_detector.detect_availability(recent_events: ctx[:recent_events])
|
|
101
99
|
[build_bias_result(:availability, domain, mag, ctx)]
|
|
102
100
|
end
|
|
103
101
|
|
|
104
102
|
def detect_recency_bias(domain, ctx)
|
|
105
103
|
return [] unless ctx[:data_points] # rubocop:disable Legion/Extension/RunnerReturnHash
|
|
106
104
|
|
|
107
|
-
mag = bias_detector.detect_recency(data_points: ctx[:data_points]
|
|
105
|
+
mag = bias_detector.detect_recency(data_points: ctx[:data_points])
|
|
108
106
|
[build_bias_result(:recency, domain, mag, ctx)]
|
|
109
107
|
end
|
|
110
108
|
|
|
@@ -113,8 +111,7 @@ module Legion
|
|
|
113
111
|
|
|
114
112
|
mag = bias_detector.detect_sunk_cost(
|
|
115
113
|
invested: ctx[:invested],
|
|
116
|
-
expected_return: ctx[:expected_return]
|
|
117
|
-
domain: domain
|
|
114
|
+
expected_return: ctx[:expected_return]
|
|
118
115
|
)
|
|
119
116
|
[build_bias_result(:sunk_cost, domain, mag, ctx)]
|
|
120
117
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Confabulation
|
|
10
10
|
module Actor
|
|
11
|
-
class Decay < Legion::Extensions::Actors::Every
|
|
11
|
+
class Decay < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Confabulation::Runners::Confabulation
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Dissonance
|
|
10
10
|
module Actor
|
|
11
|
-
class Update < Legion::Extensions::Actors::Every
|
|
11
|
+
class Update < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Dissonance::Runners::Dissonance
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module EpistemicVigilance
|
|
10
10
|
module Actor
|
|
11
|
-
class Update < Legion::Extensions::Actors::Every
|
|
11
|
+
class Update < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::EpistemicVigilance::Runners::EpistemicVigilance
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Erosion
|
|
10
10
|
module Actor
|
|
11
|
-
class Weather < Legion::Extensions::Actors::Every
|
|
11
|
+
class Weather < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Erosion::Runners::CognitiveErosion
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module ErrorMonitoring
|
|
10
10
|
module Actor
|
|
11
|
-
class Tick < Legion::Extensions::Actors::Every
|
|
11
|
+
class Tick < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::ErrorMonitoring::Runners::ErrorMonitoring
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Extinction
|
|
10
10
|
module Actor
|
|
11
|
-
class ProtocolMonitor < Legion::Extensions::Actors::Every
|
|
11
|
+
class ProtocolMonitor < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Extinction::Runners::Extinction
|
|
14
14
|
end
|
|
@@ -40,7 +40,7 @@ module Legion
|
|
|
40
40
|
def deescalate(target_level, authority:, reason:)
|
|
41
41
|
authority = authority.to_sym if authority.respond_to?(:to_sym)
|
|
42
42
|
return :not_active unless @active
|
|
43
|
-
return :invalid_target
|
|
43
|
+
return :invalid_target unless target_level.is_a?(Integer) && target_level >= 0 && target_level < @current_level
|
|
44
44
|
return :irreversible unless Levels.reversible?(@current_level)
|
|
45
45
|
return :insufficient_authority unless authority == Levels.required_authority(@current_level)
|
|
46
46
|
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module ImmuneResponse
|
|
10
10
|
module Actor
|
|
11
|
-
class Decay < Legion::Extensions::Actors::Every
|
|
11
|
+
class Decay < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::ImmuneResponse::Runners::CognitiveImmuneResponse
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Immunology
|
|
10
10
|
module Actor
|
|
11
|
-
class Decay < Legion::Extensions::Actors::Every
|
|
11
|
+
class Decay < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Immunology::Runners::CognitiveImmunology
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Phantom
|
|
10
10
|
module Actor
|
|
11
|
-
class Decay < Legion::Extensions::Actors::Every
|
|
11
|
+
class Decay < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Phantom::Runners::CognitivePhantom
|
|
14
14
|
end
|
|
@@ -8,7 +8,7 @@ module Legion
|
|
|
8
8
|
module Defense
|
|
9
9
|
module Whirlpool
|
|
10
10
|
module Actor
|
|
11
|
-
class Tick < Legion::Extensions::Actors::Every
|
|
11
|
+
class Tick < Legion::Extensions::Actors::Every
|
|
12
12
|
def runner_class
|
|
13
13
|
Legion::Extensions::Agentic::Defense::Whirlpool::Runners::CognitiveWhirlpool
|
|
14
14
|
end
|
|
@@ -179,6 +179,23 @@ RSpec.describe Legion::Extensions::Agentic::Defense::Extinction::Helpers::Protoc
|
|
|
179
179
|
end
|
|
180
180
|
end
|
|
181
181
|
|
|
182
|
+
context 'when the target is outside the containment level domain' do
|
|
183
|
+
before { state.escalate(2, authority: :governance_council, reason: 'setup') }
|
|
184
|
+
|
|
185
|
+
[-1, 0.5, nil, '0'].each do |target|
|
|
186
|
+
it "rejects #{target.inspect} without changing containment or history" do
|
|
187
|
+
history = state.history.dup
|
|
188
|
+
|
|
189
|
+
result = state.deescalate(target, authority: :governance_council, reason: 'invalid request')
|
|
190
|
+
|
|
191
|
+
expect(result).to eq(:invalid_target)
|
|
192
|
+
expect(state.current_level).to eq(2)
|
|
193
|
+
expect(state.active).to be true
|
|
194
|
+
expect(state.history).to eq(history)
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
182
199
|
context 'when current level is irreversible (level 4)' do
|
|
183
200
|
before do
|
|
184
201
|
state.escalate(1, authority: :governance_council, reason: 's1')
|