class LittleGhost::CodeMode::Engine
Adapter contract for a code-mode language.
An Engine describes the language shown to the model and opens one Session. Model-authored code must run behind the supplied sandbox_factory. The Broker must remain in the trusted parent process; do not expose it or its application objects inside the child interpreter.
LittleGhost may call one registered Engine instance concurrently for different Agents and RunContexts. Keep mutable program state in the Session returned by open_session, not on the Engine.
Public Instance Methods
Source
# File lib/little_ghost/code_mode/engine.rb, line 22 def instructions(catalog:) = raise(AbstractMethodError, "engine must provide instructions")
Source
# File lib/little_ghost/code_mode/engine.rb, line 17 def language = raise(AbstractMethodError, "engine must report its language")
Returns the engine’s language identifier as a Symbol.
# File lib/little_ghost/code_mode/engine.rb, line 33 def open_session(broker:, sandbox_factory:, limits:) = raise(AbstractMethodError, "engine must open a session")
Opens and returns a CodeMode::Session.
broker is called only from trusted parent code. sandbox_factory creates the Sandbox that contains model-authored execution. limits is the application’s mapping, passed through unchanged. A custom Engine must normalize keys and values, validate supported settings, and merge its own safe defaults. The Session owns every Workspace, Sandbox, process, thread, and channel it creates. This method may be called concurrently; each call must return an independent Session.