Class: AgentHarness::Providers::Opencode

Inherits:
Base
  • Object
show all
Defined in:
lib/agent_harness/providers/opencode.rb

Overview

OpenCode CLI provider

Provides integration with the OpenCode CLI tool.

Constant Summary

Constants inherited from Base

Base::COMMON_ERROR_PATTERNS

Instance Attribute Summary

Attributes inherited from Base

#config, #executor, #logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#configure, #initialize, #sandboxed_environment?, #send_message

Methods included from Adapter

#auth_type, #build_mcp_flags, #dangerous_mode_flags, #fetch_mcp_servers, #health_status, included, #parse_rate_limit_reset, #send_message, #session_flags, #supported_mcp_transports, #supports_dangerous_mode?, #supports_mcp?, #supports_sessions?, #validate_config, #validate_mcp_servers!

Constructor Details

This class inherits a constructor from AgentHarness::Providers::Base

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/agent_harness/providers/opencode.rb', line 18

def available?
  executor = AgentHarness.configuration.command_executor
  !!executor.which(binary_name)
end

.binary_nameObject



14
15
16
# File 'lib/agent_harness/providers/opencode.rb', line 14

def binary_name
  "opencode"
end

.discover_modelsObject



36
37
38
39
# File 'lib/agent_harness/providers/opencode.rb', line 36

def discover_models
  return [] unless available?
  []
end

.firewall_requirementsObject



23
24
25
26
27
28
29
30
# File 'lib/agent_harness/providers/opencode.rb', line 23

def firewall_requirements
  {
    domains: [
      "api.openai.com"
    ],
    ip_ranges: []
  }
end

.instruction_file_pathsObject



32
33
34
# File 'lib/agent_harness/providers/opencode.rb', line 32

def instruction_file_paths
  []
end

.provider_nameObject



10
11
12
# File 'lib/agent_harness/providers/opencode.rb', line 10

def provider_name
  :opencode
end

Instance Method Details

#capabilitiesObject



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/agent_harness/providers/opencode.rb', line 58

def capabilities
  {
    streaming: false,
    file_upload: false,
    vision: false,
    tool_use: false,
    json_mode: false,
    mcp: false,
    dangerous_mode: false
  }
end

#configuration_schemaObject



50
51
52
53
54
55
56
# File 'lib/agent_harness/providers/opencode.rb', line 50

def configuration_schema
  {
    fields: [],
    auth_modes: [:api_key],
    openai_compatible: true
  }
end

#display_nameObject



46
47
48
# File 'lib/agent_harness/providers/opencode.rb', line 46

def display_name
  "OpenCode CLI"
end

#error_patternsObject



70
71
72
# File 'lib/agent_harness/providers/opencode.rb', line 70

def error_patterns
  COMMON_ERROR_PATTERNS
end

#execution_semanticsObject



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/agent_harness/providers/opencode.rb', line 74

def execution_semantics
  {
    prompt_delivery: :arg,
    output_format: :text,
    sandbox_aware: false,
    uses_subcommand: true,
    non_interactive_flag: nil,
    legitimate_exit_codes: [0],
    stderr_is_diagnostic: true,
    parses_rate_limit_reset: false
  }
end

#nameObject



42
43
44
# File 'lib/agent_harness/providers/opencode.rb', line 42

def name
  "opencode"
end