Module: Legion::Extensions::Agentic::Attention::Focus::Runners::Attention
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/attention/focus/runners/attention.rb
Instance Method Summary collapse
- #attention_status ⇒ Object
- #filter_signals(signals: [], active_wonders: []) ⇒ Object
- #focus_on(domain:, reason: nil) ⇒ Object
- #habituation_stats ⇒ Object
- #release_focus(domain:) ⇒ Object
Instance Method Details
#attention_status ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/legion/extensions/agentic/attention/focus/runners/attention.rb', line 35 def attention_status(**) { manual_focus: focus_manager.manual_focus, habituated_domains: habituation_model.habituated_domains, habituation_stats: habituation_model.stats, capacity: Helpers::Constants::ATTENTIONAL_CAPACITY, focus_count: focus_manager.manual_focus.size } end |
#filter_signals(signals: [], active_wonders: []) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/legion/extensions/agentic/attention/focus/runners/attention.rb', line 13 def filter_signals(signals: [], active_wonders: [], **) return { filtered: [], spotlight: 0, peripheral: 0, background: 0, dropped: 0 } if signals.empty? unique = Helpers::Focus.deduplicate(signals) scored = score_all(unique, active_wonders) categorized = categorize(scored) habituation_model.decay_all log.debug("[attention] filtered #{signals.size}->#{categorized[:spotlight].size + categorized[:peripheral].size} " \ "(spotlight=#{categorized[:spotlight].size} peripheral=#{categorized[:peripheral].size} " \ "background=#{categorized[:background].size} dropped=#{categorized[:dropped]})") { filtered: categorized[:spotlight] + categorized[:peripheral], spotlight: categorized[:spotlight].size, peripheral: categorized[:peripheral].size, background: categorized[:background].size, dropped: categorized[:dropped] } end |
#focus_on(domain:, reason: nil) ⇒ Object
45 46 47 48 49 |
# File 'lib/legion/extensions/agentic/attention/focus/runners/attention.rb', line 45 def focus_on(domain:, reason: nil, **) result = focus_manager.focus_on(domain, reason: reason) log.info("[attention] focus_on #{domain}: #{result}") { status: result, domain: domain } end |
#habituation_stats ⇒ Object
57 58 59 |
# File 'lib/legion/extensions/agentic/attention/focus/runners/attention.rb', line 57 def habituation_stats(**) { domains: habituation_model.stats, habituated: habituation_model.habituated_domains } end |
#release_focus(domain:) ⇒ Object
51 52 53 54 55 |
# File 'lib/legion/extensions/agentic/attention/focus/runners/attention.rb', line 51 def release_focus(domain:, **) result = focus_manager.release(domain) log.info("[attention] release_focus #{domain}: #{result}") { status: result, domain: domain } end |