Class: AgentHarness::Providers::Kilocode

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

Overview

Kilocode CLI provider

Provides integration with the Kilocode CLI tool.

Constant Summary collapse

PACKAGE_NAME =
"@kilocode/cli"
DEFAULT_VERSION =
"7.1.3"
SUPPORTED_VERSION_REQUIREMENT =
"= #{DEFAULT_VERSION}"
STRUCTURED_EVENT_TYPES =
%w[text error step_finish result usage].freeze
USAGE_EVENT_TYPES =
%w[result usage].freeze
TOKEN_USAGE_KEYS =
%w[
  input_tokens
  output_tokens
  total_tokens
  total
  reasoning_tokens
  cache_creation_input_tokens
  cache_read_input_tokens
  cache_write_input_tokens
].freeze

Constants inherited from Base

Base::COMMON_ERROR_PATTERNS, Base::DEFAULT_SMOKE_TEST_CONTRACT

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, #configuration_schema, #dangerous_mode_flags, #fetch_mcp_servers, #health_status, included, metadata_package_name, normalize_metadata_installation, normalize_metadata_source_type, normalize_metadata_version_requirement, #parse_rate_limit_reset, #send_message, #session_flags, #smoke_test, #smoke_test_contract, #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)


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

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

.binary_nameObject



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

def binary_name
  "kilo"
end

.discover_modelsObject



52
53
54
55
# File 'lib/agent_harness/providers/kilocode.rb', line 52

def discover_models
  return [] unless available?
  []
end

.firewall_requirementsObject



41
42
43
44
45
46
# File 'lib/agent_harness/providers/kilocode.rb', line 41

def firewall_requirements
  {
    domains: [],
    ip_ranges: []
  }
end

.install_command(version: DEFAULT_VERSION) ⇒ Object



74
75
76
# File 'lib/agent_harness/providers/kilocode.rb', line 74

def install_command(version: DEFAULT_VERSION)
  installation_contract(version: version)[:install_command]
end

.installation_contract(version: DEFAULT_VERSION) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/agent_harness/providers/kilocode.rb', line 57

def installation_contract(version: DEFAULT_VERSION)
  version = version.strip if version.respond_to?(:strip)
  validate_install_version!(version)
  package_spec = "#{PACKAGE_NAME}@#{version}"

  {
    source: {
      type: :npm,
      package: PACKAGE_NAME
    },
    install_command: ["npm", "install", "-g", "--ignore-scripts", package_spec],
    binary_name: binary_name,
    default_version: DEFAULT_VERSION,
    supported_version_requirement: SUPPORTED_VERSION_REQUIREMENT
  }
end

.instruction_file_pathsObject



48
49
50
# File 'lib/agent_harness/providers/kilocode.rb', line 48

def instruction_file_paths
  []
end

.provider_nameObject



28
29
30
# File 'lib/agent_harness/providers/kilocode.rb', line 28

def provider_name
  :kilocode
end

.smoke_test_contractObject



78
79
80
# File 'lib/agent_harness/providers/kilocode.rb', line 78

def smoke_test_contract
  Base::DEFAULT_SMOKE_TEST_CONTRACT
end

Instance Method Details

#capabilitiesObject



116
117
118
119
120
121
122
123
124
125
126
# File 'lib/agent_harness/providers/kilocode.rb', line 116

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

#display_nameObject



112
113
114
# File 'lib/agent_harness/providers/kilocode.rb', line 112

def display_name
  "Kilocode CLI"
end

#error_patternsObject



128
129
130
# File 'lib/agent_harness/providers/kilocode.rb', line 128

def error_patterns
  COMMON_ERROR_PATTERNS
end

#execution_semanticsObject



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/agent_harness/providers/kilocode.rb', line 132

def execution_semantics
  {
    prompt_delivery: :arg,
    output_format: :json,
    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



108
109
110
# File 'lib/agent_harness/providers/kilocode.rb', line 108

def name
  "kilocode"
end