class LittleGhost::CodeMode::RubyEngine
Runs model-written Ruby in a fresh sandboxed process.
Tool calls cross a bounded protocol to the trusted parent Broker. The engine uses only Ruby’s standard library and adds no runtime dependency.
LittleGhost.configure do |config| config.code_mode = {engine: :ruby, sandbox: :native} end
Constants
- DEFAULT_LIMITS
-
Resource, Tool-call, and program limits applied when the application does not override them.
Public Instance Methods
# File lib/little_ghost/code_mode/ruby_engine.rb, line 38 def instructions(catalog:, prompts: nil) renderer = prompts || ->(key, **locals) { FrameworkPrompts.new.render(key, locals:) } renderer.call("code_mode/ruby/instructions", declarations: Ruby::Catalog.new(catalog).declarations) end
Builds Ruby usage instructions and method declarations for catalog.
Source
# File lib/little_ghost/code_mode/ruby_engine.rb, line 35 def language = :ruby
Returns the :ruby language identifier.
# File lib/little_ghost/code_mode/ruby_engine.rb, line 45 def open_session(broker:, sandbox_factory:, limits: {}, framework_prompt_scope: {}) configured_limits = normalize_limits(limits, defaults: DEFAULT_LIMITS) Ruby::Session.new( broker:, sandbox_factory:, subprocess_policy: method(:allow_subprocesses_for), limits: configured_limits.except(:observation_seconds), observation_seconds: configured_limits.fetch(:observation_seconds), framework_prompt_scope: ) end
Opens a Ruby Session with engine defaults merged with limits. Unsupported limit keys raise ArgumentError.