Class: OllamaAgent::Runtime::IntentTranslator
- Inherits:
-
Object
- Object
- OllamaAgent::Runtime::IntentTranslator
- Defined in:
- lib/ollama_agent/runtime/intent_translator.rb
Overview
Maps Agent tool call payloads to KernelPipeline intent hashes (incl. expected_pre_hash). rubocop:disable Metrics/ClassLength – one module per tool family; kept explicit for review
Constant Summary collapse
- TOOL_TO_METHOD =
{ "write_file" => :translate_write_file, "edit_file" => :translate_edit_file, "apply_patch" => :translate_apply_patch, "delete_file" => :translate_delete_file, "rename_file" => :translate_rename_file, "move_file" => :translate_rename_file }.freeze
Instance Method Summary collapse
-
#initialize(workspace_root:) ⇒ IntentTranslator
constructor
A new instance of IntentTranslator.
-
#translate(tool_call:) ⇒ Hash
Intent for KernelPipeline#execute.
Constructor Details
#initialize(workspace_root:) ⇒ IntentTranslator
Returns a new instance of IntentTranslator.
23 24 25 |
# File 'lib/ollama_agent/runtime/intent_translator.rb', line 23 def initialize(workspace_root:) @root = File.(workspace_root.to_s) end |
Instance Method Details
#translate(tool_call:) ⇒ Hash
Returns intent for KernelPipeline#execute.
29 30 31 32 33 34 35 |
# File 'lib/ollama_agent/runtime/intent_translator.rb', line 29 def translate(tool_call:) tc = normalize_tool_call(tool_call) meth = TOOL_TO_METHOD[tc[:name]] raise ArgumentError, "IntentTranslator does not support tool #{tc[:name].inspect}" unless meth send(meth, tc[:arguments]) end |