module LittleGhost::CodeMode
Runs model-authored orchestration code in a child interpreter. Built-in engines keep Tool authority in the parent process: each Tool call returns to a trusted Broker for catalog validation and ordinary Agent dispatch. Custom engines must preserve the Engine and Session containment contracts.
See the Code Mode guide for the first Ruby program, Broker boundary, lifecycle, limits, optional JavaScript engine, and extension contract.
Public Class Methods
# File lib/little_ghost/code_mode.rb, line 17 def register_engine(name, implementation) unless engine_class?(implementation) || implementation.is_a?(Engine) raise ArgumentError, "code-mode engine must be an Engine class or instance" end engines[name.to_sym] = implementation end
Registers implementation under a trusted engine name.
Source
# File lib/little_ghost/code_mode.rb, line 26 def resolve_engine(value) return engines.fetch(value.to_sym) { raise DependencyError, "code-mode engine :#{value} is not available" } if value.is_a?(Symbol) || value.is_a?(String) unless engine_class?(value) || value.is_a?(Engine) raise ArgumentError, "code-mode engine must be an Engine class or instance" end value end
Resolves a registered name or returns an explicit engine object.