Class: Legion::Extensions::Agentic::Executive::Autopilot::Helpers::ModeEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Executive::Autopilot::Helpers::ModeEvent
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb
Constant Summary
Constants included from Constants
Constants::AUTOPILOT_COST, Constants::AUTOPILOT_THRESHOLD, Constants::DEFAULT_ENERGY, Constants::DELIBERATE_COST, Constants::DELIBERATE_THRESHOLD, Constants::ENERGY_LABELS, Constants::FAMILIARITY_BOOST, Constants::FAMILIARITY_DECAY, Constants::FAMILIARITY_LABELS, Constants::MAX_EVENTS, Constants::MAX_ROUTINES, Constants::MODE_LABELS, Constants::OVERRIDE_COST, Constants::PROCESSING_MODES, Constants::TASK_DOMAINS
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#energy_cost ⇒ Object
readonly
Returns the value of attribute energy_cost.
-
#from_mode ⇒ Object
readonly
Returns the value of attribute from_mode.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#to_mode ⇒ Object
readonly
Returns the value of attribute to_mode.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
- #engage_autopilot? ⇒ Boolean
-
#initialize(from_mode:, to_mode:, trigger:, energy_cost: 0.0) ⇒ ModeEvent
constructor
A new instance of ModeEvent.
- #override? ⇒ Boolean
- #to_h ⇒ Object
Methods included from Constants
Constructor Details
#initialize(from_mode:, to_mode:, trigger:, energy_cost: 0.0) ⇒ ModeEvent
Returns a new instance of ModeEvent.
16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 16 def initialize(from_mode:, to_mode:, trigger:, energy_cost: 0.0) @id = SecureRandom.uuid @from_mode = from_mode.to_sym @to_mode = to_mode.to_sym @trigger = trigger.to_s @energy_cost = energy_cost.to_f.clamp(0.0, 1.0).round(10) @created_at = Time.now.utc end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 14 def created_at @created_at end |
#energy_cost ⇒ Object (readonly)
Returns the value of attribute energy_cost.
14 15 16 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 14 def energy_cost @energy_cost end |
#from_mode ⇒ Object (readonly)
Returns the value of attribute from_mode.
14 15 16 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 14 def from_mode @from_mode end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 14 def id @id end |
#to_mode ⇒ Object (readonly)
Returns the value of attribute to_mode.
14 15 16 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 14 def to_mode @to_mode end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
14 15 16 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 14 def trigger @trigger end |
Instance Method Details
#engage_autopilot? ⇒ Boolean
29 30 31 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 29 def engage_autopilot? @from_mode == :deliberate && @to_mode == :autopilot end |
#override? ⇒ Boolean
25 26 27 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 25 def override? @from_mode == :autopilot && @to_mode == :deliberate end |
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/legion/extensions/agentic/executive/autopilot/helpers/mode_event.rb', line 33 def to_h { id: @id, from_mode: @from_mode, to_mode: @to_mode, trigger: @trigger, energy_cost: @energy_cost, override: override?, engage_autopilot: engage_autopilot?, created_at: @created_at } end |