Class: Aidp::ProviderManager

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/provider_manager.rb

Class Method Summary collapse

Class Method Details

.clear_cacheObject

Clear provider cache



121
122
123
# File 'lib/aidp/provider_manager.rb', line 121

def clear_cache
  @harness_factory&.clear_cache
end

.create_harness_provider(provider_name, options = {}) ⇒ Object

Create provider using harness configuration



32
33
34
35
36
37
# File 'lib/aidp/provider_manager.rb', line 32

def create_harness_provider(provider_name, options = {})
  factory = get_harness_factory
  raise "Harness factory not available" unless factory

  factory.create_provider(provider_name, options)
end

.get_all_providers(options = {}) ⇒ Object

Get all configured providers



40
41
42
43
44
45
# File 'lib/aidp/provider_manager.rb', line 40

def get_all_providers(options = {})
  factory = get_harness_factory
  return [] unless factory

  factory.create_all_providers(options)
end

.get_enabled_providers(options = {}) ⇒ Object

Get enabled providers



56
57
58
59
60
61
62
# File 'lib/aidp/provider_manager.rb', line 56

def get_enabled_providers(options = {})
  factory = get_harness_factory
  return [] unless factory

  enabled_names = factory.enabled_providers(options)
  factory.create_providers(enabled_names, options)
end

.get_harness_factoryObject

Get harness factory instance



22
23
24
25
26
27
28
29
# File 'lib/aidp/provider_manager.rb', line 22

def get_harness_factory
  @harness_factory ||= begin
    require_relative "harness/config_manager"
    Aidp::Harness::ProviderFactory.new
  rescue LoadError
    nil
  end
end

.get_provider(provider_type, options = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/aidp/provider_manager.rb', line 9

def get_provider(provider_type, options = {})
  factory = get_harness_factory
  raise "Harness factory not available" unless factory

  factory.create_provider(provider_type, options)
end

.get_provider_capabilities(provider_name, options = {}) ⇒ Object

Get provider capabilities



81
82
83
84
85
86
# File 'lib/aidp/provider_manager.rb', line 81

def get_provider_capabilities(provider_name, options = {})
  factory = get_harness_factory
  return [] unless factory

  factory.provider_capabilities(provider_name, options)
end

.get_provider_models(provider_name, options = {}) ⇒ Object

Get provider models



97
98
99
100
101
102
# File 'lib/aidp/provider_manager.rb', line 97

def get_provider_models(provider_name, options = {})
  factory = get_harness_factory
  return [] unless factory

  factory.provider_models(provider_name, options)
end

.get_providers_by_priority(options = {}) ⇒ Object

Get providers by priority



48
49
50
51
52
53
# File 'lib/aidp/provider_manager.rb', line 48

def get_providers_by_priority(options = {})
  factory = get_harness_factory
  return [] unless factory

  factory.create_providers_by_priority(options)
end

.load_from_config(config = {}, options = {}) ⇒ Object



16
17
18
19
# File 'lib/aidp/provider_manager.rb', line 16

def load_from_config(config = {}, options = {})
  provider_type = config["provider"] || "cursor"
  get_provider(provider_type, options)
end

.provider_configured?(provider_name, options = {}) ⇒ Boolean

Check if provider is configured

Returns:

  • (Boolean)


65
66
67
68
69
70
# File 'lib/aidp/provider_manager.rb', line 65

def provider_configured?(provider_name, options = {})
  factory = get_harness_factory
  return false unless factory

  factory.configured_providers(options).include?(provider_name.to_s)
end

.provider_enabled?(provider_name, options = {}) ⇒ Boolean

Check if provider is enabled

Returns:

  • (Boolean)


73
74
75
76
77
78
# File 'lib/aidp/provider_manager.rb', line 73

def provider_enabled?(provider_name, options = {})
  factory = get_harness_factory
  return false unless factory

  factory.enabled_providers(options).include?(provider_name.to_s)
end

.provider_supports_feature?(provider_name, feature, options = {}) ⇒ Boolean

Check if provider supports feature

Returns:

  • (Boolean)


89
90
91
92
93
94
# File 'lib/aidp/provider_manager.rb', line 89

def provider_supports_feature?(provider_name, feature, options = {})
  factory = get_harness_factory
  return false unless factory

  factory.provider_supports_feature?(provider_name, feature, options)
end

.reload_configObject

Reload configuration



126
127
128
# File 'lib/aidp/provider_manager.rb', line 126

def reload_config
  @harness_factory&.reload_config
end

.validate_all_provider_configs(options = {}) ⇒ Object

Validate all provider configurations



113
114
115
116
117
118
# File 'lib/aidp/provider_manager.rb', line 113

def validate_all_provider_configs(options = {})
  factory = get_harness_factory
  return {} unless factory

  factory.validate_all_provider_configs(options)
end

.validate_provider_config(provider_name, options = {}) ⇒ Object

Validate provider configuration



105
106
107
108
109
110
# File 'lib/aidp/provider_manager.rb', line 105

def validate_provider_config(provider_name, options = {})
  factory = get_harness_factory
  return ["Harness factory not available"] unless factory

  factory.validate_provider_config(provider_name, options)
end