Class: RubynCode::IDE::Handlers::PlanProposeHandler
- Inherits:
-
Object
- Object
- RubynCode::IDE::Handlers::PlanProposeHandler
- Defined in:
- lib/rubyn_code/ide/handlers/plan_propose_handler.rb
Overview
Handles the “plan/propose” JSON-RPC request.
Synchronous: blocks until the LLM returns a structured plan or raises. The extension shows a progress spinner during the call; plan generation typically takes 5-30s.
Response shape mirrors what the extension’s PlanManager.toPlan expects: { slug, feature, phases: [{ number, name, slug, summary, requirements_md, design_md, tasks_md }] }.
Constant Summary collapse
- INVALID_PROPOSAL_CODE =
JSON-RPC error code: a clear signal to the extension that the LLM produced an unparseable / malformed plan_proposal. The extension surfaces this with the actual error message.
-32_001
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(server, proposer: nil) ⇒ PlanProposeHandler
constructor
A new instance of PlanProposeHandler.
Constructor Details
#initialize(server, proposer: nil) ⇒ PlanProposeHandler
Returns a new instance of PlanProposeHandler.
23 24 25 26 |
# File 'lib/rubyn_code/ide/handlers/plan_propose_handler.rb', line 23 def initialize(server, proposer: nil) @server = server @proposer = proposer end |
Instance Method Details
#call(params) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubyn_code/ide/handlers/plan_propose_handler.rb', line 28 def call(params) feature = params['feature'].to_s.strip raise Protocol::JsonRpcError.new(Protocol::INVALID_PARAMS, 'feature is required') if feature.empty? proposer = @proposer || Megaplan::PlanProposer.new proposer.propose(feature) rescue Megaplan::PlanProposer::InvalidProposalError => e warn "[PlanProposeHandler] invalid proposal: #{e.}" raise Protocol::JsonRpcError.new(INVALID_PROPOSAL_CODE, e.) end |