Module: Legion::Extensions::Agentic::Defense::Extinction::Runners::Extinction
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb
Constant Summary collapse
- STALE_ESCALATION_THRESHOLD =
86_400
Instance Method Summary collapse
- #check_reversibility(level:) ⇒ Object
- #deescalate(authority:, reason:, target_level: 0) ⇒ Object
- #escalate(level:, authority:, reason:) ⇒ Object
- #extinction_status ⇒ Object
- #monitor_protocol ⇒ Object
Instance Method Details
#check_reversibility(level:) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb', line 60 def check_reversibility(level:, **) reversible = Helpers::Levels.reversible?(level) log.debug("[extinction] reversibility: level=#{level} reversible=#{reversible}") { level: level, reversible: reversible, authority: Helpers::Levels.(level) } end |
#deescalate(authority:, reason:, target_level: 0) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb', line 28 def deescalate(authority:, reason:, target_level: 0, **) result = protocol_state.deescalate(target_level, authority: , reason: reason) case result when :deescalated log.info("[extinction] de-escalated: target=#{target_level} authority=#{} reason=#{reason}") { deescalated: true, level: target_level } else log.debug("[extinction] de-escalation denied: target=#{target_level} reason=#{result}") { deescalated: false, reason: result } end end |
#escalate(level:, authority:, reason:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb', line 13 def escalate(level:, authority:, reason:, **) result = protocol_state.escalate(level, authority: , reason: reason) case result when :escalated info = Helpers::Levels.level_info(level) log.warn("[extinction] ESCALATED: level=#{level} name=#{info[:name]} authority=#{} reason=#{reason}") enforce_escalation_effects(level) emit_escalation_event(level, , reason) { escalated: true, level: level, info: info } else log.debug("[extinction] escalation denied: level=#{level} reason=#{result}") { escalated: false, reason: result } end end |
#extinction_status ⇒ Object
40 41 42 43 44 |
# File 'lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb', line 40 def extinction_status(**) status = protocol_state.to_h log.debug("[extinction] status: level=#{status[:current_level]} active=#{status[:active]}") status end |
#monitor_protocol ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb', line 46 def monitor_protocol(**) status = protocol_state.to_h level = status[:current_level] if level.positive? log.warn("[extinction] ACTIVE: level=#{level} active=#{status[:active]}") detect_stale_escalation(level) else log.debug('[extinction] status: level=0 active=false') end status end |