Class: RubynCode::IDE::Handlers::CancelHandler
- Inherits:
-
Object
- Object
- RubynCode::IDE::Handlers::CancelHandler
- Defined in:
- lib/rubyn_code/ide/handlers/cancel_handler.rb
Overview
Handles the “cancel” JSON-RPC request.
Signals the agent loop thread for the given session to stop, then returns confirmation.
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(server) ⇒ CancelHandler
constructor
A new instance of CancelHandler.
Constructor Details
#initialize(server) ⇒ CancelHandler
Returns a new instance of CancelHandler.
11 12 13 |
# File 'lib/rubyn_code/ide/handlers/cancel_handler.rb', line 11 def initialize(server) @server = server end |
Instance Method Details
#call(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubyn_code/ide/handlers/cancel_handler.rb', line 15 def call(params) session_id = params['sessionId'] return { 'cancelled' => false, 'error' => 'Missing sessionId' } unless session_id # Delegate to the PromptHandler which owns the session threads prompt_handler = @server.handler_instance(:prompt) prompt_handler&.cancel_session(session_id) # Fire the stop hook so extensions can react to session cancellation fire_stop_hook(session_id) { 'cancelled' => true, 'sessionId' => session_id } end |