Class: OllamaAgent::Runtime::KernelBridge
- Inherits:
-
Object
- Object
- OllamaAgent::Runtime::KernelBridge
- Defined in:
- lib/ollama_agent/runtime/kernel_bridge.rb
Overview
Bridge object that preserves legacy behavior while exposing a kernel integration hook behind a feature flag. rubocop:disable Metrics/ClassLength – agent dispatch + pipeline routing stay in one place
Class Method Summary collapse
- .parse_env_list(key, default) ⇒ Object
-
.pipeline_tool_names ⇒ Object
Tools routed through KernelPipeline (others stay on legacy guarded dispatch).
Instance Method Summary collapse
- #append_tool_results(messages:, tool_calls:) ⇒ Object
-
#initialize(agent, pipeline: nil) ⇒ KernelBridge
constructor
A new instance of KernelBridge.
Constructor Details
#initialize(agent, pipeline: nil) ⇒ KernelBridge
Returns a new instance of KernelBridge.
29 30 31 32 33 34 |
# File 'lib/ollama_agent/runtime/kernel_bridge.rb', line 29 def initialize(agent, pipeline: nil) @agent = agent @pipeline = pipeline @permission_bridge_memo = false @permission_bridge = nil end |
Class Method Details
.parse_env_list(key, default) ⇒ Object
23 24 25 |
# File 'lib/ollama_agent/runtime/kernel_bridge.rb', line 23 def parse_env_list(key, default) ENV.fetch(key, default).split(",").map(&:strip).reject(&:empty?) end |
.pipeline_tool_names ⇒ Object
Tools routed through OllamaAgent::Runtime::KernelPipeline (others stay on legacy guarded dispatch).
18 19 20 21 |
# File 'lib/ollama_agent/runtime/kernel_bridge.rb', line 18 def pipeline_tool_names default = "write_file,edit_file,apply_patch,delete_file,rename_file,move_file" parse_env_list("OLLAMA_AGENT_KERNEL_PIPELINE_TOOLS", default) end |
Instance Method Details
#append_tool_results(messages:, tool_calls:) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/ollama_agent/runtime/kernel_bridge.rb', line 36 def append_tool_results(messages:, tool_calls:) return legacy_append(messages: , tool_calls: tool_calls) unless KernelFeature.enabled? emit_kernel_bridge_hook!(tool_calls) tool_calls.each { |tool_call| append_one_tool!(, tool_call) } end |