Module: Legion::Extensions::Agentic::Attention::Lighthouse::Runners::CognitiveLighthouse

Extended by:
CognitiveLighthouse
Includes:
Helpers::Lex
Included in:
Client, CognitiveLighthouse
Defined in:
lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb

Instance Method Summary collapse

Instance Method Details

#create_fog(fog_type:, domain:, density: nil, extent: nil, engine: nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb', line 31

def create_fog(fog_type:, domain:, density: nil, extent: nil, engine: nil, **)
  eng = resolve_engine(engine)
  fog = eng.create_fog(fog_type: fog_type, domain: domain,
                       density: density, extent: extent)
  log.debug("[lighthouse] created fog: type=#{fog_type} domain=#{domain} " \
            "density=#{fog.density}")
  { success: true, fog: fog.to_h }
rescue ArgumentError => e
  { success: false, error: e.message }
end

#light_beacon(beacon_type:, domain:, content:, luminosity: nil, sweep_angle: nil, engine: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb', line 14

def light_beacon(beacon_type:, domain:, content:, luminosity: nil,
                 sweep_angle: nil, engine: nil, **)
  eng    = resolve_engine(engine)
  beacon = eng.light_beacon(
    beacon_type: beacon_type,
    domain:      domain,
    content:     content,
    luminosity:  luminosity,
    sweep_angle: sweep_angle
  )
  log.debug("[lighthouse] lit beacon: type=#{beacon_type} domain=#{domain} " \
            "luminosity=#{beacon.luminosity}")
  { success: true, beacon: beacon.to_h }
rescue ArgumentError => e
  { success: false, error: e.message }
end

#list_beacons(engine: nil, domain: nil, beacon_type: nil) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb', line 52

def list_beacons(engine: nil, domain: nil, beacon_type: nil, **)
  eng     = resolve_engine(engine)
  results = eng.all_beacons
  results = results.select { |b| b.domain == domain.to_s } if domain
  results = results.select { |b| b.beacon_type == beacon_type.to_sym } if beacon_type
  { success: true, beacons: results.map(&:to_h), count: results.size }
end


60
61
62
63
# File 'lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb', line 60

def navigation_status(engine: nil, **)
  eng = resolve_engine(engine)
  { success: true, report: eng.visibility_report }
end

#sweep(beacon_id:, fog_id:, engine: nil) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/legion/extensions/agentic/attention/lighthouse/runners/cognitive_lighthouse.rb', line 42

def sweep(beacon_id:, fog_id:, engine: nil, **)
  eng    = resolve_engine(engine)
  result = eng.sweep(beacon_id: beacon_id, fog_id: fog_id)
  log.debug("[lighthouse] sweep: beacon=#{beacon_id} fog=#{fog_id} " \
            "reduction=#{result[:reduction]}")
  { success: true, **result }
rescue ArgumentError => e
  { success: false, error: e.message }
end