Module: RubyCoded::Chat::BridgeCommon::ModeTransitions

Defined in:
lib/ruby_coded/chat/bridge_common/mode_transitions.rb

Overview

Encapsulates transitions between chat/agent/plan modes and keeps the associated State flags (agentic_mode, plan tracking, auto-approve) consistent.

Instance Method Summary collapse

Instance Method Details

#agentic_mode?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ruby_coded/chat/bridge_common/mode_transitions.rb', line 12

def agentic_mode?
  @mode.agent?
end

#plan_mode?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ruby_coded/chat/bridge_common/mode_transitions.rb', line 16

def plan_mode?
  @mode.plan?
end

#toggle_agentic_mode!(enabled) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/ruby_coded/chat/bridge_common/mode_transitions.rb', line 20

def toggle_agentic_mode!(enabled)
  if enabled
    transition_to_agent!
  else
    transition_out_of_agent!
  end
  after_mode_change!
end

#toggle_plan_mode!(enabled) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/ruby_coded/chat/bridge_common/mode_transitions.rb', line 29

def toggle_plan_mode!(enabled)
  if enabled
    transition_to_plan!
  elsif @mode.plan?
    @mode = RuntimeMode.chat
  end
  after_mode_change!
end