Class: RubyLLM::Toolbox::Tools::ProcessList
- Defined in:
- lib/ruby_llm/toolbox/tools/process_list.rb
Overview
SAFE. Lists the background processes started this session, with their id, status, pid, age, and command — so an agent can rediscover ids and see what’s still running.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#call, exec_tool!, exec_tool?, #initialize, #name
Constructor Details
This class inherits a constructor from RubyLLM::Toolbox::Base
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby_llm/toolbox/tools/process_list.rb', line 16 def execute procs = ProcessRegistry.all return "no background processes" if procs.empty? lines = procs.map do |proc| status = proc.status == :exited ? "exited(#{proc.exit_code})" : "running" "#{proc.id} #{status.ljust(12)} pid=#{proc.pid} age=#{proc.age.round}s #{proc.name} #{proc.argv.inspect}" end truncate(([+"#{procs.size} process#{procs.size == 1 ? '' : 'es'}:"] + lines).join("\n")) end |