lex-extinction 0.2.9 → 0.2.11
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/README.md +19 -2
- data/lib/legion/extensions/extinction/actors/protocol_monitor.rb +2 -35
- data/lib/legion/extensions/extinction/runners/extinction.rb +31 -13
- data/lib/legion/extensions/extinction/version.rb +1 -1
- data/lib/legion/extensions/extinction.rb +12 -0
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3fa77e1ce3dafb0879e5b18386cc8056796e20861855c63a7fc73df4507a6f5
|
|
4
|
+
data.tar.gz: d061c82dd9fda61be0ddec8221018b85fb258237508d42253e36b0643ce9ac7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80939e380ae28829beeef151e69a0556339f3ca93d1f441728aa0c34efd9b4a6cfbeb30163dd2fdb664d5616ed6d4d792fb0b214bf389374d67b31f131a1cec0
|
|
7
|
+
data.tar.gz: 38990bc6101b79618fa1b0115c826c863804326ec7f0918edd7a276e36ced5685a0e05206f236f7375843a367a4498ecc24c17738dbfb8b6697cdfdcce8bff73
|
data/README.md
CHANGED
|
@@ -12,6 +12,12 @@ Five-level safety containment and termination protocol for LegionIO agents. Prov
|
|
|
12
12
|
| 3 | Memory lockdown | council + executive | yes |
|
|
13
13
|
| 4 | Cryptographic erasure | physical keyholders | **no** |
|
|
14
14
|
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
gem 'lex-extinction'
|
|
19
|
+
```
|
|
20
|
+
|
|
15
21
|
## Usage
|
|
16
22
|
|
|
17
23
|
```ruby
|
|
@@ -39,6 +45,17 @@ client.full_termination(
|
|
|
39
45
|
)
|
|
40
46
|
```
|
|
41
47
|
|
|
48
|
+
## Runner Methods
|
|
49
|
+
|
|
50
|
+
| Method | Key Args | Returns |
|
|
51
|
+
|--------|----------|---------|
|
|
52
|
+
| `escalate` | `level:, authority:, reason:` | `{ success:, previous_level:, current_level: }` |
|
|
53
|
+
| `deescalate` | `target_level:, authority:, reason:` | `{ success:, previous_level:, current_level: }` |
|
|
54
|
+
| `extinction_status` | — | `{ success:, state:, level_info: }` |
|
|
55
|
+
| `monitor_protocol` | — | `{ success:, state:, stale:, checked_at: }` |
|
|
56
|
+
| `archive_agent` | `agent_id:, reason:, metadata: {}` | `{ success:, archive: }` |
|
|
57
|
+
| `full_termination` | `agent_id:, authority:, reason:` | governance check → archive → escalate(4) |
|
|
58
|
+
|
|
42
59
|
## Configuration
|
|
43
60
|
|
|
44
61
|
```yaml
|
|
@@ -57,9 +74,9 @@ extinction:
|
|
|
57
74
|
|
|
58
75
|
## Architecture Notes
|
|
59
76
|
|
|
60
|
-
- Level 4 (cryptographic erasure) triggers `lex-privatecore`'s `full_erasure` on all memory traces.
|
|
77
|
+
- Level 4 (cryptographic erasure) triggers `lex-privatecore`'s `full_erasure` on all memory traces (guarded with `defined?`).
|
|
61
78
|
- State is persisted to `Legion::Data::Local` when available; falls back to in-memory storage.
|
|
62
|
-
- All escalations/de-escalations fire `Legion::Events` notifications and write to `Legion::Extensions::Audit`.
|
|
79
|
+
- All escalations/de-escalations fire `Legion::Events` notifications (`extinction.escalated`, `extinction.deescalated`, `extinction.level_N`) and write to `Legion::Extensions::Audit`.
|
|
63
80
|
- `lex-governance` integration is guarded with `defined?()` — the gem functions without it.
|
|
64
81
|
|
|
65
82
|
## Development
|
|
@@ -7,7 +7,7 @@ module Legion
|
|
|
7
7
|
if defined?(Legion::Extensions::Actors::Every)
|
|
8
8
|
class ProtocolMonitor < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
|
|
9
9
|
def runner_class
|
|
10
|
-
|
|
10
|
+
Legion::Extensions::Extinction::Runners::Extinction
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def runner_function
|
|
@@ -26,7 +26,7 @@ module Legion
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def use_runner?
|
|
29
|
-
|
|
29
|
+
true
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def check_subtask?
|
|
@@ -37,41 +37,8 @@ module Legion
|
|
|
37
37
|
false
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def monitor_protocol(**)
|
|
41
|
-
state = build_state
|
|
42
|
-
last_change = state[:last_change]
|
|
43
|
-
stale = check_stale(last_change)
|
|
44
|
-
|
|
45
|
-
log.debug "[extinction] monitor_protocol: level=#{state[:current_level]} stale=#{stale}"
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
success: true,
|
|
49
|
-
state: state,
|
|
50
|
-
stale: stale,
|
|
51
|
-
checked_at: Time.now.utc.iso8601
|
|
52
|
-
}
|
|
53
|
-
end
|
|
54
|
-
|
|
55
40
|
private
|
|
56
41
|
|
|
57
|
-
def build_state
|
|
58
|
-
{
|
|
59
|
-
current_level: 0,
|
|
60
|
-
level_name: :normal,
|
|
61
|
-
reversible: true,
|
|
62
|
-
history_count: 0,
|
|
63
|
-
last_change: nil
|
|
64
|
-
}
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def check_stale(last_change)
|
|
68
|
-
return false unless last_change
|
|
69
|
-
|
|
70
|
-
threshold_hours = Legion::Extensions::Extinction::Settings.setting(:stale_threshold_hours)
|
|
71
|
-
changed_at = Time.parse(last_change[:at]) rescue nil # rubocop:disable Style/RescueModifier
|
|
72
|
-
changed_at && (Time.now.utc - changed_at) > (threshold_hours * 3600)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
42
|
def log
|
|
76
43
|
return Legion::Logging if defined?(Legion::Logging)
|
|
77
44
|
|
|
@@ -95,26 +95,38 @@ module Legion
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def enforce_escalation_effects(level)
|
|
98
|
+
reason = "escalation to level #{level}"
|
|
98
99
|
case level
|
|
99
100
|
when 1
|
|
100
|
-
|
|
101
|
+
# Mesh disconnect depends on lex-mesh responding to the extinction.level_1 event
|
|
102
|
+
log.info '[extinction] mesh isolation: disconnecting from mesh'
|
|
103
|
+
emit_level_event(level, reason)
|
|
101
104
|
when 2
|
|
102
|
-
|
|
105
|
+
# Capability suspension depends on extensions responding to the extinction.level_2 event
|
|
106
|
+
log.warn '[extinction] capability suspension: suspending non-essential capabilities'
|
|
107
|
+
emit_level_event(level, reason)
|
|
103
108
|
when 3
|
|
109
|
+
# Memory write lock depends on lex-privatecore responding to the extinction.level_3 event
|
|
104
110
|
log.warn '[extinction] memory lockdown: locking all memory writes'
|
|
105
111
|
log.warn '[extinction] notifying privatecore of memory lockdown' if defined?(Legion::Extensions::Privatecore)
|
|
112
|
+
emit_level_event(level, reason)
|
|
106
113
|
when 4
|
|
107
114
|
log.warn '[extinction] cryptographic erasure: beginning irreversible termination'
|
|
115
|
+
emit_level_event(level, reason)
|
|
108
116
|
trigger_cryptographic_erasure
|
|
109
117
|
end
|
|
110
118
|
end
|
|
111
119
|
|
|
112
120
|
def trigger_cryptographic_erasure
|
|
113
121
|
if defined?(Legion::Extensions::Privatecore::Runners::Privatecore)
|
|
122
|
+
log.info '[extinction] invoking privatecore cryptographic erasure'
|
|
114
123
|
client = Legion::Extensions::Privatecore::Client.new if defined?(Legion::Extensions::Privatecore::Client)
|
|
115
124
|
client&.full_erasure(traces: [], agent_id: 'self')
|
|
116
125
|
end
|
|
117
126
|
log.warn '[extinction] cryptographic erasure complete'
|
|
127
|
+
rescue StandardError => e
|
|
128
|
+
log.error "[extinction] cryptographic erasure FAILED: #{e.message}"
|
|
129
|
+
raise
|
|
118
130
|
end
|
|
119
131
|
|
|
120
132
|
def emit_escalation_event(level, authority, reason)
|
|
@@ -131,16 +143,22 @@ module Legion
|
|
|
131
143
|
log.warn "[extinction] event emit failed: #{e.message}"
|
|
132
144
|
end
|
|
133
145
|
|
|
134
|
-
def
|
|
146
|
+
def emit_level_event(level, reason)
|
|
147
|
+
return unless defined?(Legion::Events)
|
|
148
|
+
|
|
149
|
+
log.info "[extinction] emitting extinction.level_#{level} event"
|
|
150
|
+
Legion::Events.emit("extinction.level_#{level}", { level: level, reason: reason, at: Time.now.utc.iso8601 })
|
|
151
|
+
rescue StandardError => e
|
|
152
|
+
log.error "[extinction] level event emit failed: #{e.message}"
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def governance_check(authority:, level: 4, _reason: nil)
|
|
135
156
|
return { success: true } unless Legion::Extensions::Extinction::Settings.setting(:governance_required)
|
|
136
|
-
return { success: true } unless defined?(Legion::Extensions::Governance)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
to_state: 'terminated',
|
|
142
|
-
principal_id: authority.to_s,
|
|
143
|
-
worker_owner: nil
|
|
157
|
+
return { success: true } unless defined?(Legion::Extensions::Agentic::Social::Governance)
|
|
158
|
+
|
|
159
|
+
log.info "[extinction] governance check: authority=#{authority} level=#{level}"
|
|
160
|
+
review = Legion::Extensions::Agentic::Social::Governance::Runners::Governance.validate_action(
|
|
161
|
+
action: "extinction_escalate_#{level}"
|
|
144
162
|
)
|
|
145
163
|
|
|
146
164
|
if review[:allowed]
|
|
@@ -149,8 +167,8 @@ module Legion
|
|
|
149
167
|
{ success: false, reason: :governance_blocked, details: review[:reasons] }
|
|
150
168
|
end
|
|
151
169
|
rescue StandardError => e
|
|
152
|
-
log.
|
|
153
|
-
{ success:
|
|
170
|
+
log.error "[extinction] governance check failed: #{e.message}"
|
|
171
|
+
{ success: false, reason: 'governance unavailable' }
|
|
154
172
|
end
|
|
155
173
|
|
|
156
174
|
def record_audit(action:, details: {})
|
|
@@ -17,6 +17,18 @@ module Legion
|
|
|
17
17
|
def self.data_required? = false
|
|
18
18
|
|
|
19
19
|
def self.remote_invocable? = false
|
|
20
|
+
|
|
21
|
+
def self.mcp_tools?
|
|
22
|
+
false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.mcp_tools_deferred?
|
|
26
|
+
false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.transport_required?
|
|
30
|
+
false
|
|
31
|
+
end
|
|
20
32
|
end
|
|
21
33
|
end
|
|
22
34
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -125,30 +125,30 @@ dependencies:
|
|
|
125
125
|
name: rubocop
|
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
|
127
127
|
requirements:
|
|
128
|
-
- - "
|
|
128
|
+
- - ">="
|
|
129
129
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '
|
|
130
|
+
version: '0'
|
|
131
131
|
type: :development
|
|
132
132
|
prerelease: false
|
|
133
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
134
134
|
requirements:
|
|
135
|
-
- - "
|
|
135
|
+
- - ">="
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: '
|
|
137
|
+
version: '0'
|
|
138
138
|
- !ruby/object:Gem::Dependency
|
|
139
139
|
name: rubocop-rspec
|
|
140
140
|
requirement: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
|
142
|
-
- - "
|
|
142
|
+
- - ">="
|
|
143
143
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: '
|
|
144
|
+
version: '0'
|
|
145
145
|
type: :development
|
|
146
146
|
prerelease: false
|
|
147
147
|
version_requirements: !ruby/object:Gem::Requirement
|
|
148
148
|
requirements:
|
|
149
|
-
- - "
|
|
149
|
+
- - ">="
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: '
|
|
151
|
+
version: '0'
|
|
152
152
|
description: Five-level extinction protocol with archival, audit trail, governance
|
|
153
153
|
gates, and configurable settings
|
|
154
154
|
email:
|