Class: RubynCode::Tools::BackgroundRun
- Defined in:
- lib/rubyn_code/tools/background_run.rb
Constant Summary collapse
- TOOL_NAME =
'background_run'- DESCRIPTION =
'Run a command in the background (test suites, builds, deploys). ' \ 'Returns immediately with a job ID. Results are delivered automatically ' \ 'before your next LLM call.'
- PARAMETERS =
{ command: { type: :string, description: 'The shell command to run in the background', required: true }, timeout: { type: :integer, description: 'Timeout in seconds (default: 300)', required: false } }.freeze
- RISK_LEVEL =
:execute
Constants inherited from Base
RubynCode::Tools::Base::REQUIRES_CONFIRMATION
Instance Attribute Summary collapse
-
#background_worker ⇒ Object
writeonly
Sets the attribute background_worker.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
description, #initialize, parameters, requires_confirmation?, risk_level, #safe_path, summarize, to_schema, tool_name, #truncate
Constructor Details
This class inherits a constructor from RubynCode::Tools::Base
Instance Attribute Details
#background_worker=(value) ⇒ Object (writeonly)
Sets the attribute background_worker
27 28 29 |
# File 'lib/rubyn_code/tools/background_run.rb', line 27 def background_worker=(value) @background_worker = value end |
Instance Method Details
#execute(command:, timeout: 300) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/rubyn_code/tools/background_run.rb', line 29 def execute(command:, timeout: 300) return 'Error: Background worker not available. Use bash tool instead.' unless @background_worker job_id = @background_worker.run(command, timeout: timeout) "Background job started: #{job_id}\nCommand: #{command}\n" \ "Timeout: #{timeout}s\nResults will appear automatically when complete." end |