Class: RubynCode::IDE::Handlers::RecoverCiHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyn_code/ide/handlers/recover_ci_handler.rb

Overview

Handles the “recover_ci” JSON-RPC request.

Takes the recovery context the extension packaged (failing log, phase docs, branch, attempt counts) and runs the agent against it. Returns the recovery_outcome { kind, commit_sha?, summary? }.

The handler spawns the actual agent work in a background thread so the JSON-RPC reply can include a sessionId immediately. The extension watches the session via the existing agent/status notifications + a terminal recovery/outcome notification carrying the structured result.

Instance Method Summary collapse

Constructor Details

#initialize(server, recovery: nil) ⇒ RecoverCiHandler

Returns a new instance of RecoverCiHandler.



20
21
22
23
# File 'lib/rubyn_code/ide/handlers/recover_ci_handler.rb', line 20

def initialize(server, recovery: nil)
  @server = server
  @recovery = recovery
end

Instance Method Details

#call(params) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/rubyn_code/ide/handlers/recover_ci_handler.rb', line 25

def call(params)
  context = normalize_params(params)
  return error_response('context required') if context.nil?

  session_id = params['sessionId'] || SecureRandom.uuid
  Thread.new do
    run_recovery(session_id, context)
  end
  { 'accepted' => true, 'sessionId' => session_id }
end