Class: Silas::Tools::RunCode
- Inherits:
-
Silas::Tool
- Object
- Silas::Tool
- Silas::Tools::RunCode
- Defined in:
- lib/silas/tools/run_code.rb
Overview
Built-in, added to the toolset only when a sandbox is configured. Runs a shell command through the configured sandbox. at_most_once! — a sandbox exec is an external effect, so a crash mid-run parks it in-doubt.
Instance Attribute Summary
Attributes inherited from Silas::Tool
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Silas::Tool
approval, #approval_policy, at_most_once!, description, effect_mode, #effect_mode, idempotent!, param, schema, transactional!, validate_signature!
Class Method Details
.tool_name ⇒ Object
13 |
# File 'lib/silas/tools/run_code.rb', line 13 def self.tool_name = "run_code" |
Instance Method Details
#call(command:, timeout: nil) ⇒ Object
15 16 17 18 |
# File 'lib/silas/tools/run_code.rb', line 15 def call(command:, timeout: nil) result = Silas.resolved_sandbox.run(command, timeout: timeout || Silas.config.sandbox_timeout) { "stdout" => result.stdout, "stderr" => result.stderr, "exit_status" => result.exit_status } end |