Class: Ralph::Agents::OpenCode

Inherits:
Base
  • Object
show all
Defined in:
lib/ralph/agents/open_code.rb

Instance Method Summary collapse

Methods inherited from Base

#build_env, #collect_tool_counts, #execute, #extract_errors, #validate!

Methods included from Helpers

#check_completion, #escape_regex, #format_duration, #format_duration_long, #format_tool_summary, #now_ms, #strip_ansi, #which

Instance Method Details

#build_args(prompt, model, _options) ⇒ Object



11
12
13
14
15
16
# File 'lib/ralph/agents/open_code.rb', line 11

def build_args(prompt, model, _options)
  args = ["run"]
  args.push("-m", model) if model && !model.empty?
  args.push(prompt)
  args
end

#commandObject



8
# File 'lib/ralph/agents/open_code.rb', line 8

def command = "opencode"

#config_nameObject



9
# File 'lib/ralph/agents/open_code.rb', line 9

def config_name = "OpenCode"

#detect_fatal_error(output) ⇒ Object



23
24
25
26
27
# File 'lib/ralph/agents/open_code.rb', line 23

def detect_fatal_error(output)
  if output.include?("ralph-wiggum is not yet ready for use. This is a placeholder package.")
    "Placeholder plugin error detected"
  end
end

#parse_tool_output(line) ⇒ Object



18
19
20
21
# File 'lib/ralph/agents/open_code.rb', line 18

def parse_tool_output(line)
  match = strip_ansi(line).match(/^\|\s{2}([A-Za-z0-9_-]+)/)
  match ? match[1] : nil
end

#typeObject



7
# File 'lib/ralph/agents/open_code.rb', line 7

def type = :opencode