Class: Legion::Extensions::Agentic::Attention::Spotlight::Helpers::AttentionTarget

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb

Constant Summary

Constants included from Constants

Constants::CAPTURE_THRESHOLD, Constants::DEFAULT_BREADTH, Constants::DEFAULT_INTENSITY, Constants::INTENSITY_GAIN, Constants::INTENSITY_LABELS, Constants::INTENSITY_LOSS, Constants::MAX_PERIPHERAL, Constants::MAX_TARGETS, Constants::MODE_LABELS, Constants::PERIPHERAL_DETECTION_THRESHOLD, Constants::ZOOM_LEVELS, Constants::ZOOM_RANGES, Constants::ZOOM_STEP

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, domain:, salience: 0.5, relevance: 0.5) ⇒ AttentionTarget

Returns a new instance of AttentionTarget.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 18

def initialize(label:, domain:, salience: 0.5, relevance: 0.5)
  @id             = SecureRandom.uuid
  @label          = label
  @domain         = domain
  @salience       = salience.clamp(0.0, 1.0)
  @relevance      = relevance.clamp(0.0, 1.0)
  @in_spotlight   = false
  @in_periphery   = false
  @capture_count  = 0
  @created_at     = Time.now.utc
  @last_attended_at = nil
end

Instance Attribute Details

#capture_countObject

Returns the value of attribute capture_count.



15
16
17
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15

def capture_count
  @capture_count
end

#created_atObject (readonly)

Returns the value of attribute created_at.



14
15
16
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14

def created_at
  @created_at
end

#domainObject (readonly)

Returns the value of attribute domain.



14
15
16
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14

def domain
  @domain
end

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14

def id
  @id
end

#in_peripheryObject

Returns the value of attribute in_periphery.



15
16
17
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15

def in_periphery
  @in_periphery
end

#in_spotlightObject

Returns the value of attribute in_spotlight.



15
16
17
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15

def in_spotlight
  @in_spotlight
end

#labelObject (readonly)

Returns the value of attribute label.



14
15
16
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14

def label
  @label
end

#last_attended_atObject

Returns the value of attribute last_attended_at.



15
16
17
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15

def last_attended_at
  @last_attended_at
end

#relevanceObject

Returns the value of attribute relevance.



15
16
17
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15

def relevance
  @relevance
end

#salienceObject

Returns the value of attribute salience.



15
16
17
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15

def salience
  @salience
end

Instance Method Details

#compelling?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 31

def compelling?
  @salience >= Constants::CAPTURE_THRESHOLD
end

#salient?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 35

def salient?
  @salience >= Constants::PERIPHERAL_DETECTION_THRESHOLD
end

#to_hObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 39

def to_h
  {
    id:               @id,
    label:            @label,
    domain:           @domain,
    salience:         @salience.round(10),
    relevance:        @relevance.round(10),
    in_spotlight:     @in_spotlight,
    in_periphery:     @in_periphery,
    capture_count:    @capture_count,
    compelling:       compelling?,
    salient:          salient?,
    created_at:       @created_at,
    last_attended_at: @last_attended_at
  }
end