Module: Legion::Extensions::Agentic::Affect::Flow::Runners::Flow
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/affect/flow/runners/flow.rb
Instance Method Summary collapse
- #flow_effects ⇒ Object
- #flow_history(limit: 20) ⇒ Object
- #flow_stats ⇒ Object
- #flow_status ⇒ Object
- #update_flow(tick_results: {}) ⇒ Object
Instance Method Details
#flow_effects ⇒ Object
46 47 48 49 50 |
# File 'lib/legion/extensions/agentic/affect/flow/runners/flow.rb', line 46 def flow_effects(**) effects = flow_detector.flow_effects log.debug("[flow] effects: #{effects}") { effects: effects, in_flow: flow_detector.in_flow?, deep_flow: flow_detector.deep_flow? } end |
#flow_history(limit: 20) ⇒ Object
52 53 54 55 56 |
# File 'lib/legion/extensions/agentic/affect/flow/runners/flow.rb', line 52 def flow_history(limit: 20, **) recent = flow_detector.history.last(limit) log.debug("[flow] history: #{recent.size} entries") { history: recent, total: flow_detector.history.size } end |
#flow_stats ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/legion/extensions/agentic/affect/flow/runners/flow.rb', line 58 def flow_stats(**) log.debug('[flow] stats') { state: flow_detector.flow_state, score: flow_detector.flow_score.round(3), consecutive_flow_ticks: flow_detector.consecutive_flow_ticks, total_flow_ticks: flow_detector.total_flow_ticks, flow_percentage: flow_detector.flow_percentage, trend: flow_detector.flow_trend, balance: flow_detector.challenge_skill_balance.round(3) } end |
#flow_status ⇒ Object
41 42 43 44 |
# File 'lib/legion/extensions/agentic/affect/flow/runners/flow.rb', line 41 def flow_status(**) log.debug("[flow] status: state=#{flow_detector.flow_state} score=#{flow_detector.flow_score.round(3)}") flow_detector.to_h end |
#update_flow(tick_results: {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/legion/extensions/agentic/affect/flow/runners/flow.rb', line 13 def update_flow(tick_results: {}, **) challenge_input = extract_challenge(tick_results) skill_input = extract_skill(tick_results) modifiers = extract_modifiers(tick_results) flow_detector.update(challenge_input: challenge_input, skill_input: skill_input, modifiers: modifiers) breakers = detect_flow_breakers(tick_results) if breakers.any? && flow_detector.in_flow? flow_detector.instance_variable_set(:@flow_state, :disrupted) flow_detector.instance_variable_set(:@consecutive_flow_ticks, 0) end log.debug("[flow] state=#{flow_detector.flow_state} score=#{flow_detector.flow_score.round(3)} " \ "deep=#{flow_detector.deep_flow?} breakers=#{breakers}") { state: flow_detector.flow_state, score: flow_detector.flow_score.round(3), in_flow: flow_detector.in_flow?, deep_flow: flow_detector.deep_flow?, effects: flow_detector.flow_effects, breakers: breakers, challenge: flow_detector.challenge.round(3), skill: flow_detector.skill.round(3) } end |