Module: AgentHarness::Providers::Adapter::ClassMethods

Defined in:
lib/agent_harness/providers/adapter.rb

Overview

Class methods that all providers must implement

Instance Method Summary collapse

Instance Method Details

#available?Boolean

Check if provider CLI is available on the system

Returns:

  • (Boolean)

    true if the CLI is installed and accessible

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/agent_harness/providers/adapter.rb', line 35

def available?
  raise NotImplementedError, "#{self} must implement .available?"
end

#binary_nameString

CLI binary name

Returns:

  • (String)

    the name of the CLI binary

Raises:

  • (NotImplementedError)


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

def binary_name
  raise NotImplementedError, "#{self} must implement .binary_name"
end

#discover_modelsArray<Hash>

Discover available models

Returns:

  • (Array<Hash>)

    list of available models



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

def discover_models
  []
end

#firewall_requirementsHash

Required domains for firewall configuration

Returns:

  • (Hash)

    with :domains and :ip_ranges arrays



60
61
62
# File 'lib/agent_harness/providers/adapter.rb', line 60

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

#install_command(version: nil) ⇒ Array<String>?

Build the install command from the provider installation contract.

Parameters:

  • version (String, nil) (defaults to: nil)

    optional explicit version override

Returns:

  • (Array<String>, nil)

    install command argv or nil when the provider has no install contract



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/agent_harness/providers/adapter.rb', line 97

def install_command(version: nil)
  contract = installation_contract
  return nil unless contract

  return contract[:install_command] unless version

  package_name = contract[:package_name]
  unless package_name
    raise ArgumentError, "installation_contract must define :package_name when overriding version"
  end

  Array(contract[:install_command_prefix]) + ["#{package_name}@#{version}"]
end

#install_contract(version: nil) ⇒ Hash?

Installation contract for the provider CLI.

Downstream applications can use this metadata to install a provider’s supported CLI without hardcoding package names, install flags, or version pins outside AgentHarness.

Returns:

  • (Hash, nil)

    installation metadata or nil when not provided



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

def install_contract(version: nil)
  nil
end

#installation_contract(**options) ⇒ Hash?

Installation contract for this provider’s CLI.

Downstream apps can use this metadata to provision the provider CLI without hardcoding package names, versions, or binary expectations outside agent-harness.

Returns:

  • (Hash, nil)

    install metadata, or nil when no first-class installation contract is defined for the provider



86
87
88
89
90
# File 'lib/agent_harness/providers/adapter.rb', line 86

def installation_contract(**options)
  return install_contract unless options.key?(:version)

  install_contract(version: options[:version])
end

#instruction_file_pathsArray<Hash>

Paths to instruction files (e.g., CLAUDE.md, .cursorrules)

Returns:

  • (Array<Hash>)

    instruction file configurations



67
68
69
# File 'lib/agent_harness/providers/adapter.rb', line 67

def instruction_file_paths
  []
end

#provider_nameSymbol

Human-readable provider name

Returns:

  • (Symbol)

    unique identifier for this provider

Raises:

  • (NotImplementedError)


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

def provider_name
  raise NotImplementedError, "#{self} must implement .provider_name"
end

#smoke_test_contractHash?

Canonical smoke-test contract for this provider.

CLI-backed providers should expose a minimal real-execution prompt so downstream apps can reuse a stable provider-owned health check.

Returns:

  • (Hash, nil)

    smoke-test metadata or nil when not provided



117
118
119
# File 'lib/agent_harness/providers/adapter.rb', line 117

def smoke_test_contract
  nil
end