Module: RubyCoded::Chat::BridgeCommon::ToolFlow

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

Overview

Shared tool-confirmation flow and cancellation signaling. Uses the State's condition variable to block the streaming thread until the TUI supplies a decision (approve/reject/cancel).

Instance Method Summary collapse

Instance Method Details

#approve_all_tools!Object



22
23
24
25
# File 'lib/ruby_coded/chat/bridge_common/tool_flow.rb', line 22

def approve_all_tools!
  @state.enable_auto_approve!
  @state.tool_confirmation_response = :approved
end

#approve_tool!Object



18
19
20
# File 'lib/ruby_coded/chat/bridge_common/tool_flow.rb', line 18

def approve_tool!
  @state.tool_confirmation_response = :approved
end

#cancel!Object



13
14
15
16
# File 'lib/ruby_coded/chat/bridge_common/tool_flow.rb', line 13

def cancel!
  @cancel_requested = true
  @state.mutex.synchronize { @state.tool_cv.signal }
end

#reject_tool!Object



27
28
29
# File 'lib/ruby_coded/chat/bridge_common/tool_flow.rb', line 27

def reject_tool!
  @state.tool_confirmation_response = :rejected
end