lex-extinction 0.2.0 → 0.2.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 +4 -4
- data/lib/legion/extensions/extinction/actors/protocol_monitor.rb +61 -24
- data/lib/legion/extensions/extinction/client.rb +6 -8
- data/lib/legion/extensions/extinction/helpers/archiver.rb +58 -0
- data/lib/legion/extensions/extinction/helpers/levels.rb +43 -18
- data/lib/legion/extensions/extinction/helpers/protocol_state.rb +67 -73
- data/lib/legion/extensions/extinction/runners/extinction.rb +125 -79
- data/lib/legion/extensions/extinction/settings.rb +26 -0
- data/lib/legion/extensions/extinction/version.rb +1 -1
- data/lib/legion/extensions/extinction.rb +12 -12
- metadata +148 -16
- data/Gemfile +0 -10
- data/lex-extinction.gemspec +0 -28
- data/lib/legion/extensions/extinction/local_migrations/20260316000040_create_extinction_state.rb +0 -13
- data/spec/legion/extensions/extinction/actors/protocol_monitor_spec.rb +0 -45
- data/spec/legion/extensions/extinction/client_spec.rb +0 -13
- data/spec/legion/extensions/extinction/helpers/levels_spec.rb +0 -180
- data/spec/legion/extensions/extinction/helpers/protocol_state_spec.rb +0 -291
- data/spec/legion/extensions/extinction/runners/extinction_spec.rb +0 -114
- data/spec/local_persistence_spec.rb +0 -188
- data/spec/spec_helper.rb +0 -20
|
@@ -1,123 +1,169 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../helpers/levels'
|
|
4
|
+
require_relative '../helpers/protocol_state'
|
|
5
|
+
require_relative '../helpers/archiver'
|
|
6
|
+
require_relative '../settings'
|
|
7
|
+
|
|
3
8
|
module Legion
|
|
4
9
|
module Extensions
|
|
5
10
|
module Extinction
|
|
6
11
|
module Runners
|
|
7
12
|
module Extinction
|
|
8
|
-
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
9
|
-
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
10
|
-
|
|
11
13
|
def escalate(level:, authority:, reason:, **)
|
|
12
|
-
result = protocol_state.escalate(level, authority: authority, reason: reason)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Legion::Logging.debug "[extinction] escalation denied: level=#{level} reason=#{result}"
|
|
22
|
-
{ escalated: false, reason: result }
|
|
14
|
+
result = protocol_state.escalate(level: level, authority: authority, reason: reason)
|
|
15
|
+
return result unless result[:success]
|
|
16
|
+
|
|
17
|
+
enforce_escalation_effects(level)
|
|
18
|
+
emit_escalation_event(level, authority, reason)
|
|
19
|
+
record_audit(action: :escalate, details: { level: level, authority: authority, reason: reason })
|
|
20
|
+
|
|
21
|
+
if Legion::Extensions::Extinction::Settings.setting(:archive_on_escalate) && level >= 3
|
|
22
|
+
archive_agent(agent_id: 'self', reason: "auto-archive at level #{level}", metadata: { triggered_by: :escalate })
|
|
23
23
|
end
|
|
24
|
+
|
|
25
|
+
result
|
|
24
26
|
end
|
|
25
27
|
|
|
26
|
-
def deescalate(authority:, reason:,
|
|
27
|
-
result = protocol_state.deescalate(target_level, authority: authority, reason: reason)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
end
|
|
28
|
+
def deescalate(target_level:, authority:, reason:, **)
|
|
29
|
+
result = protocol_state.deescalate(target_level: target_level, authority: authority, reason: reason)
|
|
30
|
+
return result unless result[:success]
|
|
31
|
+
|
|
32
|
+
emit_deescalation_event(target_level, authority, reason)
|
|
33
|
+
record_audit(action: :deescalate,
|
|
34
|
+
details: { target_level: target_level, authority: authority, reason: reason })
|
|
35
|
+
|
|
36
|
+
result
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def extinction_status(**)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
state = protocol_state.to_h
|
|
41
|
+
level_info = Helpers::Levels.level_info(state[:current_level])
|
|
42
|
+
{ success: true, state: state, level_info: level_info }
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
def monitor_protocol(**)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
state = protocol_state.to_h
|
|
47
|
+
last_change = state[:last_change]
|
|
48
|
+
stale = false
|
|
49
|
+
|
|
50
|
+
if last_change
|
|
51
|
+
threshold_hours = Legion::Extensions::Extinction::Settings.setting(:stale_threshold_hours)
|
|
52
|
+
changed_at = Time.parse(last_change[:at]) rescue nil # rubocop:disable Style/RescueModifier
|
|
53
|
+
stale = changed_at && (Time.now.utc - changed_at) > (threshold_hours * 3600)
|
|
53
54
|
end
|
|
54
55
|
|
|
55
|
-
status
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def check_reversibility(level:, **)
|
|
59
|
-
reversible = Helpers::Levels.reversible?(level)
|
|
60
|
-
Legion::Logging.debug "[extinction] reversibility: level=#{level} reversible=#{reversible}"
|
|
61
56
|
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
success: true,
|
|
58
|
+
state: state,
|
|
59
|
+
stale: stale,
|
|
60
|
+
checked_at: Time.now.utc.iso8601
|
|
65
61
|
}
|
|
66
62
|
end
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
def archive_agent(agent_id:, reason:, metadata: {}, **)
|
|
65
|
+
record = archiver.archive(agent_id: agent_id, reason: reason, metadata: metadata)
|
|
66
|
+
record_audit(action: :archive, details: { agent_id: agent_id, reason: reason })
|
|
67
|
+
{ success: true, archive: record }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def full_termination(agent_id:, authority:, reason:, **)
|
|
71
|
+
gate = governance_check(authority: authority)
|
|
72
|
+
return gate unless gate[:success]
|
|
73
|
+
|
|
74
|
+
archive_result = archive_agent(agent_id: agent_id, reason: reason,
|
|
75
|
+
metadata: { termination: true, authority: authority })
|
|
76
|
+
return archive_result unless archive_result[:success]
|
|
77
|
+
|
|
78
|
+
escalate_result = escalate(level: 4, authority: authority, reason: reason)
|
|
79
|
+
return escalate_result unless escalate_result[:success]
|
|
80
|
+
|
|
81
|
+
record_audit(action: :full_termination, details: { agent_id: agent_id, authority: authority, reason: reason })
|
|
82
|
+
{ success: true, agent_id: agent_id, archive: archive_result[:archive], terminated_at: Time.now.utc.iso8601 }
|
|
83
|
+
end
|
|
69
84
|
|
|
70
85
|
private
|
|
71
86
|
|
|
72
|
-
def
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Legion::Logging.warn '[extinction] mesh isolation enforced'
|
|
76
|
-
end
|
|
87
|
+
def protocol_state
|
|
88
|
+
@protocol_state ||= Helpers::ProtocolState.new
|
|
89
|
+
end
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
def archiver
|
|
92
|
+
@archiver ||= Helpers::Archiver.new
|
|
93
|
+
end
|
|
79
94
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
def enforce_escalation_effects(level)
|
|
96
|
+
case level
|
|
97
|
+
when 1
|
|
98
|
+
Legion::Logging.info '[extinction] mesh isolation: disconnecting from mesh' if defined?(Legion::Extensions::Mesh) && defined?(Legion::Logging)
|
|
99
|
+
when 2
|
|
100
|
+
Legion::Logging.info '[extinction] capability suspension: suspending non-essential capabilities' if defined?(Legion::Logging)
|
|
101
|
+
when 3
|
|
102
|
+
Legion::Logging.warn '[extinction] memory lockdown: locking all memory writes' if defined?(Legion::Logging)
|
|
103
|
+
if defined?(Legion::Extensions::Privatecore) && defined?(Legion::Logging)
|
|
104
|
+
Legion::Logging.warn '[extinction] notifying privatecore of memory lockdown'
|
|
105
|
+
end
|
|
106
|
+
when 4
|
|
107
|
+
Legion::Logging.warn '[extinction] cryptographic erasure: beginning irreversible termination' if defined?(Legion::Logging)
|
|
108
|
+
trigger_cryptographic_erasure
|
|
83
109
|
end
|
|
110
|
+
end
|
|
84
111
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
lifecycle_state: 'terminated', updated_at: Time.now.utc
|
|
90
|
-
)
|
|
91
|
-
rescue StandardError
|
|
92
|
-
nil
|
|
112
|
+
def trigger_cryptographic_erasure
|
|
113
|
+
if defined?(Legion::Extensions::Privatecore::Runners::Privatecore)
|
|
114
|
+
client = Legion::Extensions::Privatecore::Client.new if defined?(Legion::Extensions::Privatecore::Client)
|
|
115
|
+
client&.full_erasure(traces: [], agent_id: 'self')
|
|
93
116
|
end
|
|
94
|
-
Legion::Logging.warn '[extinction]
|
|
117
|
+
Legion::Logging.warn '[extinction] cryptographic erasure complete' if defined?(Legion::Logging)
|
|
95
118
|
end
|
|
96
119
|
|
|
97
120
|
def emit_escalation_event(level, authority, reason)
|
|
98
|
-
|
|
121
|
+
payload = { level: level, authority: authority, reason: reason, at: Time.now.utc.iso8601 }
|
|
122
|
+
Legion::Events.emit('extinction.escalated', payload) if defined?(Legion::Events)
|
|
123
|
+
rescue StandardError => e
|
|
124
|
+
Legion::Logging.warn "[extinction] event emit failed: #{e.message}" if defined?(Legion::Logging)
|
|
125
|
+
end
|
|
99
126
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
127
|
+
def emit_deescalation_event(target_level, authority, reason)
|
|
128
|
+
payload = { target_level: target_level, authority: authority, reason: reason, at: Time.now.utc.iso8601 }
|
|
129
|
+
Legion::Events.emit('extinction.deescalated', payload) if defined?(Legion::Events)
|
|
130
|
+
rescue StandardError => e
|
|
131
|
+
Legion::Logging.warn "[extinction] event emit failed: #{e.message}" if defined?(Legion::Logging)
|
|
104
132
|
end
|
|
105
133
|
|
|
106
|
-
def
|
|
107
|
-
|
|
108
|
-
return
|
|
134
|
+
def governance_check(authority:, _reason: nil)
|
|
135
|
+
return { success: true } unless Legion::Extensions::Extinction::Settings.setting(:governance_required)
|
|
136
|
+
return { success: true } unless defined?(Legion::Extensions::Governance)
|
|
109
137
|
|
|
110
|
-
Legion::
|
|
111
|
-
|
|
138
|
+
review = Legion::Extensions::Governance::Runners::Governance.review_transition(
|
|
139
|
+
worker_id: 'extinction',
|
|
140
|
+
from_state: 'active',
|
|
141
|
+
to_state: 'terminated',
|
|
142
|
+
principal_id: authority.to_s,
|
|
143
|
+
worker_owner: nil
|
|
144
|
+
)
|
|
112
145
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
146
|
+
if review[:allowed]
|
|
147
|
+
{ success: true }
|
|
148
|
+
else
|
|
149
|
+
{ success: false, reason: :governance_blocked, details: review[:reasons] }
|
|
150
|
+
end
|
|
151
|
+
rescue StandardError => e
|
|
152
|
+
Legion::Logging.warn "[extinction] governance check failed: #{e.message}" if defined?(Legion::Logging)
|
|
153
|
+
{ success: true }
|
|
117
154
|
end
|
|
118
155
|
|
|
119
|
-
def
|
|
120
|
-
|
|
156
|
+
def record_audit(action:, details: {})
|
|
157
|
+
return unless defined?(Legion::Extensions::Audit::Runners::Audit)
|
|
158
|
+
|
|
159
|
+
Legion::Extensions::Audit::Runners::Audit.record(
|
|
160
|
+
entity_type: 'extinction',
|
|
161
|
+
entity_id: 'protocol',
|
|
162
|
+
action: action,
|
|
163
|
+
details: details
|
|
164
|
+
)
|
|
165
|
+
rescue StandardError => e
|
|
166
|
+
Legion::Logging.warn "[extinction] audit record failed: #{e.message}" if defined?(Legion::Logging)
|
|
121
167
|
end
|
|
122
168
|
end
|
|
123
169
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Legion
|
|
4
|
+
module Extensions
|
|
5
|
+
module Extinction
|
|
6
|
+
module Settings
|
|
7
|
+
DEFAULTS = {
|
|
8
|
+
enabled: true,
|
|
9
|
+
governance_required: true,
|
|
10
|
+
stale_threshold_hours: 24,
|
|
11
|
+
monitor_interval: 300,
|
|
12
|
+
archive_on_escalate: true,
|
|
13
|
+
max_history: 500
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
16
|
+
def self.setting(key)
|
|
17
|
+
if defined?(Legion::Settings) && Legion::Settings[:extinction]
|
|
18
|
+
Legion::Settings[:extinction].fetch(key, DEFAULTS[key])
|
|
19
|
+
else
|
|
20
|
+
DEFAULTS[key]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
require_relative 'extinction/version'
|
|
4
|
+
require_relative 'extinction/settings'
|
|
5
|
+
require_relative 'extinction/helpers/levels'
|
|
6
|
+
require_relative 'extinction/helpers/protocol_state'
|
|
7
|
+
require_relative 'extinction/helpers/archiver'
|
|
8
|
+
require_relative 'extinction/runners/extinction'
|
|
9
|
+
|
|
10
|
+
require_relative 'extinction/actors/protocol_monitor' if defined?(Legion::Extensions::Actors::Every)
|
|
7
11
|
|
|
8
12
|
module Legion
|
|
9
13
|
module Extensions
|
|
10
14
|
module Extinction
|
|
11
|
-
extend Legion::Extensions::Core if Legion::Extensions
|
|
15
|
+
extend Legion::Extensions::Core if defined?(Legion::Extensions::Core)
|
|
16
|
+
|
|
17
|
+
data_required? false if respond_to?(:data_required?)
|
|
18
|
+
remote_invocable? false if respond_to?(:remote_invocable?)
|
|
12
19
|
end
|
|
13
20
|
end
|
|
14
21
|
end
|
|
15
|
-
|
|
16
|
-
if defined?(Legion::Data::Local)
|
|
17
|
-
Legion::Data::Local.register_migrations(
|
|
18
|
-
name: :extinction,
|
|
19
|
-
path: File.join(__dir__, 'extinction', 'local_migrations')
|
|
20
|
-
)
|
|
21
|
-
end
|
metadata
CHANGED
|
@@ -1,39 +1,171 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-extinction
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: legion-cache
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 1.3.11
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 1.3.11
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: legion-crypt
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 1.4.9
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 1.4.9
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: legion-data
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 1.4.17
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 1.4.17
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: legion-json
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 1.2.1
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 1.2.1
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: legion-logging
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 1.3.2
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: 1.3.2
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: legion-settings
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 1.3.14
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: 1.3.14
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: legion-transport
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 1.3.9
|
|
103
|
+
type: :runtime
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 1.3.9
|
|
110
|
+
- !ruby/object:Gem::Dependency
|
|
111
|
+
name: rspec
|
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - "~>"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '3.12'
|
|
117
|
+
type: :development
|
|
118
|
+
prerelease: false
|
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
120
|
+
requirements:
|
|
121
|
+
- - "~>"
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: '3.12'
|
|
124
|
+
- !ruby/object:Gem::Dependency
|
|
125
|
+
name: rubocop
|
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
- - "~>"
|
|
129
|
+
- !ruby/object:Gem::Version
|
|
130
|
+
version: '1.62'
|
|
131
|
+
type: :development
|
|
132
|
+
prerelease: false
|
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - "~>"
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: '1.62'
|
|
138
|
+
- !ruby/object:Gem::Dependency
|
|
139
|
+
name: rubocop-rspec
|
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
|
141
|
+
requirements:
|
|
142
|
+
- - "~>"
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: '2.25'
|
|
145
|
+
type: :development
|
|
146
|
+
prerelease: false
|
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - "~>"
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '2.25'
|
|
152
|
+
description: Five-level extinction protocol with archival, audit trail, governance
|
|
153
|
+
gates, and configurable settings
|
|
14
154
|
email:
|
|
15
|
-
-
|
|
155
|
+
- matt@esity.io
|
|
16
156
|
executables: []
|
|
17
157
|
extensions: []
|
|
18
158
|
extra_rdoc_files: []
|
|
19
159
|
files:
|
|
20
|
-
- Gemfile
|
|
21
|
-
- lex-extinction.gemspec
|
|
22
160
|
- lib/legion/extensions/extinction.rb
|
|
23
161
|
- lib/legion/extensions/extinction/actors/protocol_monitor.rb
|
|
24
162
|
- lib/legion/extensions/extinction/client.rb
|
|
163
|
+
- lib/legion/extensions/extinction/helpers/archiver.rb
|
|
25
164
|
- lib/legion/extensions/extinction/helpers/levels.rb
|
|
26
165
|
- lib/legion/extensions/extinction/helpers/protocol_state.rb
|
|
27
|
-
- lib/legion/extensions/extinction/local_migrations/20260316000040_create_extinction_state.rb
|
|
28
166
|
- lib/legion/extensions/extinction/runners/extinction.rb
|
|
167
|
+
- lib/legion/extensions/extinction/settings.rb
|
|
29
168
|
- lib/legion/extensions/extinction/version.rb
|
|
30
|
-
- spec/legion/extensions/extinction/actors/protocol_monitor_spec.rb
|
|
31
|
-
- spec/legion/extensions/extinction/client_spec.rb
|
|
32
|
-
- spec/legion/extensions/extinction/helpers/levels_spec.rb
|
|
33
|
-
- spec/legion/extensions/extinction/helpers/protocol_state_spec.rb
|
|
34
|
-
- spec/legion/extensions/extinction/runners/extinction_spec.rb
|
|
35
|
-
- spec/local_persistence_spec.rb
|
|
36
|
-
- spec/spec_helper.rb
|
|
37
169
|
homepage: https://github.com/LegionIO/lex-extinction
|
|
38
170
|
licenses:
|
|
39
171
|
- MIT
|
|
@@ -60,5 +192,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
60
192
|
requirements: []
|
|
61
193
|
rubygems_version: 3.6.9
|
|
62
194
|
specification_version: 4
|
|
63
|
-
summary:
|
|
195
|
+
summary: Agent lifecycle termination protocol for LegionIO
|
|
64
196
|
test_files: []
|
data/Gemfile
DELETED
data/lex-extinction.gemspec
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'lib/legion/extensions/extinction/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = 'lex-extinction'
|
|
7
|
-
spec.version = Legion::Extensions::Extinction::VERSION
|
|
8
|
-
spec.authors = ['Esity']
|
|
9
|
-
spec.email = ['matthewdiverson@gmail.com']
|
|
10
|
-
|
|
11
|
-
spec.summary = 'LEX Extinction'
|
|
12
|
-
spec.description = 'Escalation and extinction protocol (4 levels) for brain-modeled agentic AI'
|
|
13
|
-
spec.homepage = 'https://github.com/LegionIO/lex-extinction'
|
|
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'] = 'https://github.com/LegionIO/lex-extinction'
|
|
19
|
-
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-extinction'
|
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-extinction'
|
|
21
|
-
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-extinction/issues'
|
|
22
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
23
|
-
|
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
-
Dir.glob('{lib,spec}/**/*') + %w[lex-extinction.gemspec Gemfile]
|
|
26
|
-
end
|
|
27
|
-
spec.require_paths = ['lib']
|
|
28
|
-
end
|
data/lib/legion/extensions/extinction/local_migrations/20260316000040_create_extinction_state.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
Sequel.migration do
|
|
4
|
-
change do
|
|
5
|
-
create_table(:extinction_state) do
|
|
6
|
-
primary_key :id
|
|
7
|
-
Integer :current_level, null: false, default: 0
|
|
8
|
-
TrueClass :active, null: false, default: false
|
|
9
|
-
String :history, text: true
|
|
10
|
-
DateTime :updated_at
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Legion
|
|
4
|
-
module Extensions
|
|
5
|
-
module Actors
|
|
6
|
-
class Every; end # rubocop:disable Lint/EmptyClass
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
$LOADED_FEATURES << 'legion/extensions/actors/every'
|
|
12
|
-
|
|
13
|
-
require_relative '../../../../../lib/legion/extensions/extinction/actors/protocol_monitor'
|
|
14
|
-
|
|
15
|
-
RSpec.describe Legion::Extensions::Extinction::Actor::ProtocolMonitor do
|
|
16
|
-
subject(:actor) { described_class.new }
|
|
17
|
-
|
|
18
|
-
describe '#runner_class' do
|
|
19
|
-
it { expect(actor.runner_class).to eq Legion::Extensions::Extinction::Runners::Extinction }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe '#runner_function' do
|
|
23
|
-
it { expect(actor.runner_function).to eq 'monitor_protocol' }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe '#time' do
|
|
27
|
-
it { expect(actor.time).to eq 300 }
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe '#run_now?' do
|
|
31
|
-
it { expect(actor.run_now?).to be false }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe '#use_runner?' do
|
|
35
|
-
it { expect(actor.use_runner?).to be false }
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe '#check_subtask?' do
|
|
39
|
-
it { expect(actor.check_subtask?).to be false }
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe '#generate_task?' do
|
|
43
|
-
it { expect(actor.generate_task?).to be false }
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'legion/extensions/extinction/client'
|
|
4
|
-
|
|
5
|
-
RSpec.describe Legion::Extensions::Extinction::Client do
|
|
6
|
-
it 'responds to extinction runner methods' do
|
|
7
|
-
client = described_class.new
|
|
8
|
-
expect(client).to respond_to(:escalate)
|
|
9
|
-
expect(client).to respond_to(:deescalate)
|
|
10
|
-
expect(client).to respond_to(:extinction_status)
|
|
11
|
-
expect(client).to respond_to(:check_reversibility)
|
|
12
|
-
end
|
|
13
|
-
end
|