Class: Legion::Extensions::Agentic::Attention::Regulation::Helpers::AttentionTarget
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Regulation::Helpers::AttentionTarget
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb
Constant Summary
Constants included from Constants
Constants::ATTENTION_MODES, Constants::CAPTURE_THRESHOLD, Constants::DEFAULT_RESOURCE, Constants::DEFAULT_ZOOM, Constants::MAX_HISTORY, Constants::MAX_TARGETS, Constants::RESOURCE_CEILING, Constants::RESOURCE_DRAIN, Constants::RESOURCE_FLOOR, Constants::RESOURCE_LABELS, Constants::RESOURCE_RECOVERY, Constants::TARGET_STATES, Constants::ZOOM_CEILING, Constants::ZOOM_FLOOR
Instance Attribute Summary collapse
-
#attended_since ⇒ Object
readonly
Returns the value of attribute attended_since.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#salience ⇒ Object
readonly
Returns the value of attribute salience.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #attend! ⇒ Object
- #duration ⇒ Object
- #ignore! ⇒ Object
-
#initialize(id:, name:, domain: :general, salience: 0.5) ⇒ AttentionTarget
constructor
A new instance of AttentionTarget.
- #peripheral! ⇒ Object
- #salient_enough_to_capture? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, domain: :general, salience: 0.5) ⇒ AttentionTarget
Returns a new instance of AttentionTarget.
14 15 16 17 18 19 20 21 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 14 def initialize(id:, name:, domain: :general, salience: 0.5) @id = id @name = name @domain = domain @salience = salience.to_f.clamp(0.0, 1.0) @state = :peripheral @attended_since = nil end |
Instance Attribute Details
#attended_since ⇒ Object (readonly)
Returns the value of attribute attended_since.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 12 def attended_since @attended_since end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 12 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 12 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 12 def name @name end |
#salience ⇒ Object (readonly)
Returns the value of attribute salience.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 12 def salience @salience end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 12 def state @state end |
Instance Method Details
#attend! ⇒ Object
23 24 25 26 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 23 def attend! @state = :attended @attended_since = Time.now.utc end |
#duration ⇒ Object
42 43 44 45 46 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 42 def duration return nil unless @state == :attended && @attended_since Time.now.utc - @attended_since end |
#ignore! ⇒ Object
28 29 30 31 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 28 def ignore! @state = :ignored @attended_since = nil end |
#peripheral! ⇒ Object
33 34 35 36 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 33 def peripheral! @state = :peripheral @attended_since = nil end |
#salient_enough_to_capture? ⇒ Boolean
38 39 40 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 38 def salient_enough_to_capture? @salience >= CAPTURE_THRESHOLD end |
#to_h ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/legion/extensions/agentic/attention/regulation/helpers/attention_target.rb', line 48 def to_h { id: @id, name: @name, domain: @domain, salience: @salience.round(4), state: @state, attended_since: @attended_since } end |