lex-extinction 0.2.4 → 0.2.8
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/lib/legion/extensions/extinction/actors/protocol_monitor.rb +12 -3
- data/lib/legion/extensions/extinction/helpers/archiver.rb +9 -1
- data/lib/legion/extensions/extinction/helpers/protocol_state.rb +10 -2
- data/lib/legion/extensions/extinction/runners/extinction.rb +18 -12
- data/lib/legion/extensions/extinction/version.rb +1 -1
- 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: d003d2c9912679ec68f06d9c09baf2f6dc327823e900bbcfa6573c295a7b233e
|
|
4
|
+
data.tar.gz: dada6a5d374c8dfe5b7ad6ec7585634d5ed889e60a28d4546db5716b5fada680
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9826102ae5f6c1213adf8e3ae282b6025e0073061b2802659464e6bd188f15836b1df9e4439ce000ed859c8db13211909e965d350077cbb437bf2b74a544d071
|
|
7
|
+
data.tar.gz: 1d6bf45afff49e163e38a87eb4ffed46556a5f60f69a390e0a265a6b53d8cd7b28f7b71567d5e2dec34a7014c7058ca859a6d7f9efec3d700b625e7a26e01e25
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Legion
|
|
4
4
|
module Extensions
|
|
5
5
|
module Extinction
|
|
6
|
-
module
|
|
6
|
+
module Actor
|
|
7
7
|
if defined?(Legion::Extensions::Actors::Every)
|
|
8
8
|
class ProtocolMonitor < Legion::Extensions::Actors::Every
|
|
9
9
|
def runner_class
|
|
@@ -16,7 +16,8 @@ module Legion
|
|
|
16
16
|
|
|
17
17
|
def time
|
|
18
18
|
Legion::Extensions::Extinction::Settings.setting(:monitor_interval)
|
|
19
|
-
rescue StandardError
|
|
19
|
+
rescue StandardError => e
|
|
20
|
+
log.debug("monitor_interval setting unavailable: #{e.message}")
|
|
20
21
|
300
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -41,7 +42,7 @@ module Legion
|
|
|
41
42
|
last_change = state[:last_change]
|
|
42
43
|
stale = check_stale(last_change)
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
log.debug "[extinction] monitor_protocol: level=#{state[:current_level]} stale=#{stale}"
|
|
45
46
|
|
|
46
47
|
{
|
|
47
48
|
success: true,
|
|
@@ -70,6 +71,14 @@ module Legion
|
|
|
70
71
|
changed_at = Time.parse(last_change[:at]) rescue nil # rubocop:disable Style/RescueModifier
|
|
71
72
|
changed_at && (Time.now.utc - changed_at) > (threshold_hours * 3600)
|
|
72
73
|
end
|
|
74
|
+
|
|
75
|
+
def log
|
|
76
|
+
return Legion::Logging if defined?(Legion::Logging)
|
|
77
|
+
|
|
78
|
+
@log ||= Object.new.tap do |nl|
|
|
79
|
+
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
80
|
+
end
|
|
81
|
+
end
|
|
73
82
|
end
|
|
74
83
|
end
|
|
75
84
|
end
|
|
@@ -48,9 +48,17 @@ module Legion
|
|
|
48
48
|
end
|
|
49
49
|
@archives << record
|
|
50
50
|
rescue StandardError => e
|
|
51
|
-
|
|
51
|
+
log.warn "[extinction] archive persist failed: #{e.message}"
|
|
52
52
|
@archives << record
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
def log
|
|
56
|
+
return Legion::Logging if defined?(Legion::Logging)
|
|
57
|
+
|
|
58
|
+
@log ||= Object.new.tap do |nl|
|
|
59
|
+
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
54
62
|
end
|
|
55
63
|
end
|
|
56
64
|
end
|
|
@@ -91,7 +91,7 @@ module Legion
|
|
|
91
91
|
@store[:protocol_state] = data
|
|
92
92
|
end
|
|
93
93
|
rescue StandardError => e
|
|
94
|
-
|
|
94
|
+
log.warn "[extinction] protocol_state save failed: #{e.message}"
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def load_from_local
|
|
@@ -106,7 +106,15 @@ module Legion
|
|
|
106
106
|
raw_history = data[:history] || data['history'] || []
|
|
107
107
|
@history = raw_history
|
|
108
108
|
rescue StandardError => e
|
|
109
|
-
|
|
109
|
+
log.warn "[extinction] protocol_state load failed: #{e.message}"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def log
|
|
113
|
+
return Legion::Logging if defined?(Legion::Logging)
|
|
114
|
+
|
|
115
|
+
@log ||= Object.new.tap do |nl|
|
|
116
|
+
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
117
|
+
end
|
|
110
118
|
end
|
|
111
119
|
end
|
|
112
120
|
end
|
|
@@ -95,16 +95,14 @@ module Legion
|
|
|
95
95
|
def enforce_escalation_effects(level)
|
|
96
96
|
case level
|
|
97
97
|
when 1
|
|
98
|
-
|
|
98
|
+
log.info '[extinction] mesh isolation: disconnecting from mesh' if defined?(Legion::Extensions::Mesh)
|
|
99
99
|
when 2
|
|
100
|
-
|
|
100
|
+
log.info '[extinction] capability suspension: suspending non-essential capabilities'
|
|
101
101
|
when 3
|
|
102
|
-
|
|
103
|
-
if defined?(Legion::Extensions::Privatecore)
|
|
104
|
-
Legion::Logging.warn '[extinction] notifying privatecore of memory lockdown'
|
|
105
|
-
end
|
|
102
|
+
log.warn '[extinction] memory lockdown: locking all memory writes'
|
|
103
|
+
log.warn '[extinction] notifying privatecore of memory lockdown' if defined?(Legion::Extensions::Privatecore)
|
|
106
104
|
when 4
|
|
107
|
-
|
|
105
|
+
log.warn '[extinction] cryptographic erasure: beginning irreversible termination'
|
|
108
106
|
trigger_cryptographic_erasure
|
|
109
107
|
end
|
|
110
108
|
end
|
|
@@ -114,21 +112,21 @@ module Legion
|
|
|
114
112
|
client = Legion::Extensions::Privatecore::Client.new if defined?(Legion::Extensions::Privatecore::Client)
|
|
115
113
|
client&.full_erasure(traces: [], agent_id: 'self')
|
|
116
114
|
end
|
|
117
|
-
|
|
115
|
+
log.warn '[extinction] cryptographic erasure complete'
|
|
118
116
|
end
|
|
119
117
|
|
|
120
118
|
def emit_escalation_event(level, authority, reason)
|
|
121
119
|
payload = { level: level, authority: authority, reason: reason, at: Time.now.utc.iso8601 }
|
|
122
120
|
Legion::Events.emit('extinction.escalated', payload) if defined?(Legion::Events)
|
|
123
121
|
rescue StandardError => e
|
|
124
|
-
|
|
122
|
+
log.warn "[extinction] event emit failed: #{e.message}"
|
|
125
123
|
end
|
|
126
124
|
|
|
127
125
|
def emit_deescalation_event(target_level, authority, reason)
|
|
128
126
|
payload = { target_level: target_level, authority: authority, reason: reason, at: Time.now.utc.iso8601 }
|
|
129
127
|
Legion::Events.emit('extinction.deescalated', payload) if defined?(Legion::Events)
|
|
130
128
|
rescue StandardError => e
|
|
131
|
-
|
|
129
|
+
log.warn "[extinction] event emit failed: #{e.message}"
|
|
132
130
|
end
|
|
133
131
|
|
|
134
132
|
def governance_check(authority:, _reason: nil)
|
|
@@ -149,7 +147,7 @@ module Legion
|
|
|
149
147
|
{ success: false, reason: :governance_blocked, details: review[:reasons] }
|
|
150
148
|
end
|
|
151
149
|
rescue StandardError => e
|
|
152
|
-
|
|
150
|
+
log.warn "[extinction] governance check failed: #{e.message}"
|
|
153
151
|
{ success: true }
|
|
154
152
|
end
|
|
155
153
|
|
|
@@ -163,7 +161,15 @@ module Legion
|
|
|
163
161
|
details: details
|
|
164
162
|
)
|
|
165
163
|
rescue StandardError => e
|
|
166
|
-
|
|
164
|
+
log.warn "[extinction] audit record failed: #{e.message}"
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def log
|
|
168
|
+
return Legion::Logging if defined?(Legion::Logging)
|
|
169
|
+
|
|
170
|
+
@log ||= Object.new.tap do |nl|
|
|
171
|
+
%i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
|
|
172
|
+
end
|
|
167
173
|
end
|
|
168
174
|
end
|
|
169
175
|
end
|