Class: Aidp::Execute::InteractiveRepl
- Inherits:
-
Object
- Object
- Aidp::Execute::InteractiveRepl
- Includes:
- RescueLogging
- Defined in:
- lib/aidp/execute/interactive_repl.rb
Overview
Interactive REPL for controlling async work loops Provides live control during work loop execution:
-
Pause/resume/cancel work loop
-
Inject instructions mid-execution
-
Update configuration live
-
View streaming output
-
Rollback commits
Usage:
repl = InteractiveRepl.new(project_dir, provider_manager, config)
repl.start_work_loop(step_name, step_spec, context)
Instance Attribute Summary collapse
-
#async_runner ⇒ Object
readonly
Returns the value of attribute async_runner.
-
#completion_setup_needed ⇒ Object
readonly
Returns the value of attribute completion_setup_needed.
-
#output_display_thread ⇒ Object
readonly
Returns the value of attribute output_display_thread.
-
#repl_macros ⇒ Object
readonly
Returns the value of attribute repl_macros.
-
#running ⇒ Object
Expose running state and repl_macros for testability.
Instance Method Summary collapse
-
#initialize(project_dir, provider_manager, config, options = {}) ⇒ InteractiveRepl
constructor
A new instance of InteractiveRepl.
-
#start_work_loop(step_name, step_spec, context = {}) ⇒ Object
Start work loop and enter interactive REPL.
Methods included from RescueLogging
__log_rescue_impl, log_rescue, #log_rescue
Constructor Details
#initialize(project_dir, provider_manager, config, options = {}) ⇒ InteractiveRepl
Returns a new instance of InteractiveRepl.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/aidp/execute/interactive_repl.rb', line 30 def initialize(project_dir, provider_manager, config, = {}) @project_dir = project_dir @provider_manager = provider_manager @config = config = @prompt = [:prompt] || TTY::Prompt.new @async_runner_class = [:async_runner_class] || AsyncWorkLoopRunner @async_runner = [:async_runner] @repl_macros = [:repl_macros] || ReplMacros.new @output_display_thread = nil @running = false @completion_setup_needed = true end |
Instance Attribute Details
#async_runner ⇒ Object (readonly)
Returns the value of attribute async_runner.
28 29 30 |
# File 'lib/aidp/execute/interactive_repl.rb', line 28 def async_runner @async_runner end |
#completion_setup_needed ⇒ Object (readonly)
Returns the value of attribute completion_setup_needed.
28 29 30 |
# File 'lib/aidp/execute/interactive_repl.rb', line 28 def completion_setup_needed @completion_setup_needed end |
#output_display_thread ⇒ Object (readonly)
Returns the value of attribute output_display_thread.
28 29 30 |
# File 'lib/aidp/execute/interactive_repl.rb', line 28 def output_display_thread @output_display_thread end |
#repl_macros ⇒ Object (readonly)
Returns the value of attribute repl_macros.
28 29 30 |
# File 'lib/aidp/execute/interactive_repl.rb', line 28 def repl_macros @repl_macros end |
#running ⇒ Object
Expose running state and repl_macros for testability
27 28 29 |
# File 'lib/aidp/execute/interactive_repl.rb', line 27 def running @running end |
Instance Method Details
#start_work_loop(step_name, step_spec, context = {}) ⇒ Object
Start work loop and enter interactive REPL
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/aidp/execute/interactive_repl.rb', line 45 def start_work_loop(step_name, step_spec, context = {}) @async_runner = @async_runner_class.new( @project_dir, @provider_manager, @config, ) display_welcome(step_name) # Start async work loop result = @async_runner.execute_step_async(step_name, step_spec, context) @prompt.say("Work loop started (#{result[:state][:state]})") # Start output display thread start_output_display # Enter REPL loop @running = true repl_loop # Wait for completion final_result = @async_runner.wait # Stop output display stop_output_display display_completion(final_result) final_result end |