Class: Legion::Extensions::Agentic::Attention::Telescope::Helpers::ObservatoryEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb

Instance Method Summary collapse

Constructor Details

#initializeObservatoryEngine

Returns a new instance of ObservatoryEngine.



10
11
12
13
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 10

def initialize
  @telescopes   = {}
  @observations = []
end

Instance Method Details

#all_observationsObject



77
78
79
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 77

def all_observations
  @observations.dup
end

#all_telescopesObject



73
74
75
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 73

def all_telescopes
  @telescopes.values
end

#create_telescope(lens_type:, aperture: 0.5, magnification: 1.0, tracking: false) ⇒ Object

Create and register a new telescope

Raises:

  • (ArgumentError)


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 16

def create_telescope(lens_type:, aperture: 0.5, magnification: 1.0, tracking: false)
  raise ArgumentError, 'observatory full' if @telescopes.size >= Constants::MAX_TELESCOPES

  scope = Telescope.new(
    lens_type:     lens_type,
    aperture:      aperture,
    magnification: magnification,
    tracking:      tracking
  )
  @telescopes[scope.id] = scope
  scope
end

#deep_focus!(telescope_id:) ⇒ Object

Deep-focus mode: zoom in to MAX_MAGNIFICATION



67
68
69
70
71
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 67

def deep_focus!(telescope_id:)
  scope = fetch_telescope(telescope_id)
  scope.zoom_in!(Constants::MAX_MAGNIFICATION)
  scope
end

#focus_telescope(telescope_id:, target_distance:) ⇒ Object

Focus a telescope at a given target distance



40
41
42
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 40

def focus_telescope(telescope_id:, target_distance:)
  fetch_telescope(telescope_id).focus!(target_distance)
end

#observatory_reportObject

Summary report for the observatory



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 86

def observatory_report
  {
    total_telescopes:    @telescopes.size,
    total_observations:  @observations.size,
    significant_count:   significant_observations.size,
    faint_count:         @observations.count(&:faint?),
    avg_detail:          avg_detail,
    deepest_observation: deepest_observation,
    widest_telescope:    widest_telescope
  }
end

#observe(telescope_id:, target:, distance:) ⇒ Object

Record an observation for a target at a given distance

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 45

def observe(telescope_id:, target:, distance:)
  raise ArgumentError, 'observation log full' if @observations.size >= Constants::MAX_OBSERVATIONS

  scope = fetch_telescope(telescope_id)
  obs   = Observation.new(
    telescope_id:            scope.id,
    target:                  target,
    distance:                distance,
    telescope_magnification: scope.magnification
  )
  @observations << obs
  obs
end

#significant_observationsObject



81
82
83
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 81

def significant_observations
  @observations.select(&:significant?)
end

#survey_mode!(telescope_id:) ⇒ Object

Survey mode: zoom out to BASE_MAGNIFICATION (wide-field scan)



60
61
62
63
64
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 60

def survey_mode!(telescope_id:)
  scope = fetch_telescope(telescope_id)
  scope.zoom_out!(scope.magnification)
  scope
end

#zoom_in(telescope_id:, factor:) ⇒ Object

Zoom in on a telescope by multiplying magnification



30
31
32
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observatory_engine.rb', line 30

def zoom_in(telescope_id:, factor:)
  fetch_telescope(telescope_id).zoom_in!(factor)
end

#zoom_out(telescope_id:, factor:) ⇒ Object

Zoom out on a telescope by dividing magnification



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

def zoom_out(telescope_id:, factor:)
  fetch_telescope(telescope_id).zoom_out!(factor)
end