active_harness 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,25 @@
1
+ require_relative "active_harness/configuration"
1
2
  require_relative "active_harness/core/errors"
2
3
  require_relative "active_harness/result"
3
4
  require_relative "active_harness/http/client"
4
5
  require_relative "active_harness/http/streaming_client"
6
+ require_relative "active_harness/http/retry_policy"
5
7
  require_relative "active_harness/providers/base"
6
8
  require_relative "active_harness/providers/openai"
7
9
  require_relative "active_harness/providers/openrouter"
8
10
  require_relative "active_harness/providers/groq"
9
11
  require_relative "active_harness/providers/gemini"
10
12
  require_relative "active_harness/providers/anthropic"
13
+ require_relative "active_harness/providers/xai"
14
+ require_relative "active_harness/providers/deepseek"
15
+ require_relative "active_harness/providers/mistral"
16
+ require_relative "active_harness/providers/ollama"
17
+ require_relative "active_harness/providers/perplexity"
18
+ require_relative "active_harness/providers/gpustack"
19
+ require_relative "active_harness/providers/azure"
20
+ require_relative "active_harness/providers/bedrock"
21
+ require_relative "active_harness/providers/vertexai"
22
+ require_relative "active_harness/providers/custom"
11
23
  require_relative "active_harness/memory"
12
24
  require_relative "active_harness/agent"
13
25
  require_relative "active_harness/tribunal"
@@ -17,4 +29,27 @@ require_relative "active_harness/railtie" if defined?(Rails::Railtie)
17
29
 
18
30
  module ActiveHarness
19
31
  VERSION = "0.2.0"
32
+
33
+ class << self
34
+ # Configure ActiveHarness.
35
+ #
36
+ # ActiveHarness.configure do |config|
37
+ # config.openai_api_key = ENV["OPENAI_API_KEY"]
38
+ # config.openai_api_url = "https://api.openai.com/v1/chat/completions"
39
+ # end
40
+ def configure
41
+ yield config
42
+ end
43
+
44
+ # Returns the singleton Configuration instance.
45
+ # Lazily initialized on first access.
46
+ def config
47
+ @config ||= Configuration.new
48
+ end
49
+
50
+ # Reset config to defaults (useful in tests).
51
+ def reset_config!
52
+ @config = nil
53
+ end
54
+ end
20
55
  end
@@ -16,6 +16,22 @@ module ActiveHarness
16
16
  end
17
17
  end
18
18
 
19
+ def create_initializer
20
+ target = File.join(destination_root, "config", "initializers", "active_harness.rb")
21
+ return if File.exist?(target)
22
+
23
+ copy_file "initializers/active_harness.rb",
24
+ "config/initializers/active_harness.rb"
25
+ end
26
+
27
+ def create_initializer
28
+ target = File.join(destination_root, "config", "initializers", "active_harness.rb")
29
+ return if File.exist?(target)
30
+
31
+ copy_file "initializers/active_harness.rb",
32
+ "config/initializers/active_harness.rb"
33
+ end
34
+
19
35
  def copy_controller
20
36
  target = File.join(destination_root, "app", "controllers", "ai_support_controller.rb")
21
37
  return if File.exist?(target)
@@ -0,0 +1,101 @@
1
+ # config/initializers/active_harness.rb
2
+ #
3
+ # Configure ActiveHarness.
4
+ # All values fall back to the corresponding ENV variable if not set here,
5
+ # so you can use either approach — or mix both.
6
+
7
+ ActiveHarness.configure do |config|
8
+ # ---------------------------------------------------------------------------
9
+ # OpenAI
10
+ # ---------------------------------------------------------------------------
11
+ config.openai_api_key = ENV["OPENAI_API_KEY"]
12
+ # config.openai_api_url = "https://api.openai.com/v1/chat/completions"
13
+
14
+ # ---------------------------------------------------------------------------
15
+ # Anthropic
16
+ # ---------------------------------------------------------------------------
17
+ config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
18
+ # config.anthropic_api_url = "https://api.anthropic.com/v1/messages"
19
+
20
+ # ---------------------------------------------------------------------------
21
+ # Google Gemini
22
+ # ---------------------------------------------------------------------------
23
+ config.gemini_api_key = ENV["GEMINI_API_KEY"]
24
+ # config.gemini_api_url = "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions"
25
+
26
+ # ---------------------------------------------------------------------------
27
+ # Groq
28
+ # ---------------------------------------------------------------------------
29
+ config.groq_api_key = ENV["GROQ_API_KEY"]
30
+ # config.groq_api_url = "https://api.groq.com/openai/v1/chat/completions"
31
+
32
+ # ---------------------------------------------------------------------------
33
+ # OpenRouter
34
+ # ---------------------------------------------------------------------------
35
+ config.openrouter_api_key = ENV["OPENROUTER_API_KEY"]
36
+ # config.openrouter_api_url = "https://openrouter.ai/api/v1/chat/completions"
37
+ # config.openrouter_http_referer = "https://your-app.com"
38
+
39
+ # ---------------------------------------------------------------------------
40
+ # xAI (Grok)
41
+ # ---------------------------------------------------------------------------
42
+ config.xai_api_key = ENV["XAI_API_KEY"]
43
+ # config.xai_api_url = "https://api.x.ai/v1/chat/completions"
44
+
45
+ # ---------------------------------------------------------------------------
46
+ # DeepSeek
47
+ # ---------------------------------------------------------------------------
48
+ config.deepseek_api_key = ENV["DEEPSEEK_API_KEY"]
49
+ # config.deepseek_api_url = "https://api.deepseek.com/v1/chat/completions"
50
+
51
+ # ---------------------------------------------------------------------------
52
+ # Mistral
53
+ # ---------------------------------------------------------------------------
54
+ config.mistral_api_key = ENV["MISTRAL_API_KEY"]
55
+ # config.mistral_api_url = "https://api.mistral.ai/v1/chat/completions"
56
+
57
+ # ---------------------------------------------------------------------------
58
+ # Ollama (local — API key is optional)
59
+ # ---------------------------------------------------------------------------
60
+ # config.ollama_api_base = "http://localhost:11434"
61
+ # config.ollama_api_key = nil
62
+
63
+ # ---------------------------------------------------------------------------
64
+ # Perplexity
65
+ # ---------------------------------------------------------------------------
66
+ config.perplexity_api_key = ENV["PERPLEXITY_API_KEY"]
67
+ # config.perplexity_api_url = "https://api.perplexity.ai/chat/completions"
68
+
69
+ # ---------------------------------------------------------------------------
70
+ # GPUStack (self-hosted — API key is optional)
71
+ # ---------------------------------------------------------------------------
72
+ # config.gpustack_api_base = "http://my-gpustack-server:80"
73
+ # config.gpustack_api_key = ENV["GPUSTACK_API_KEY"]
74
+
75
+ # ---------------------------------------------------------------------------
76
+ # Azure OpenAI Service
77
+ # The `model:` in your agent config is the deployment name, not the model name.
78
+ # ---------------------------------------------------------------------------
79
+ # config.azure_api_base = ENV["AZURE_API_BASE"] # "https://my-resource.openai.azure.com"
80
+ # config.azure_api_key = ENV["AZURE_API_KEY"] # resource API key (preferred)
81
+ # config.azure_ai_auth_token = ENV["AZURE_AI_AUTH_TOKEN"] # OAuth bearer (alternative)
82
+ # config.azure_api_version = "2024-05-01-preview"
83
+
84
+ # ---------------------------------------------------------------------------
85
+ # Custom providers — any OpenAI-compatible endpoint
86
+ # Register as many as you need under arbitrary names.
87
+ # `api_key` is optional — omit for local servers without auth.
88
+ # ---------------------------------------------------------------------------
89
+ # config.custom["MyLocal"]["url"] = "http://localhost:8080/v1/chat/completions"
90
+ # config.custom["MyLocal"]["api_key"] = ENV["MYLOCAL_API_KEY"]
91
+ #
92
+ # config.custom["VLLMServer"]["url"] = "http://gpu-server:8000/v1/chat/completions"
93
+ # config.custom["VLLMServer"]["api_key"] = ENV["VLLM_API_KEY"]
94
+ #
95
+ # Use in an agent:
96
+ # model do
97
+ # use provider: :custom, name: "MyLocal", model: "llama3.2"
98
+ # fallback provider: :custom, name: "VLLMServer", model: "mixtral"
99
+ # fallback provider: :openai, model: "gpt-4o-mini"
100
+ # end
101
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - the-teacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-21 00:00:00.000000000 Z
11
+ date: 2026-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -38,8 +38,11 @@ files:
38
38
  - lib/active_harness/agent/output_parser.rb
39
39
  - lib/active_harness/agent/prompt.rb
40
40
  - lib/active_harness/agent/providers.rb
41
+ - lib/active_harness/agent/ruby_llm_backend.rb
42
+ - lib/active_harness/configuration.rb
41
43
  - lib/active_harness/core/errors.rb
42
44
  - lib/active_harness/http/client.rb
45
+ - lib/active_harness/http/retry_policy.rb
43
46
  - lib/active_harness/http/streaming_client.rb
44
47
  - lib/active_harness/memory.rb
45
48
  - lib/active_harness/memory/adapter/base.rb
@@ -48,11 +51,21 @@ files:
48
51
  - lib/active_harness/pipeline/step.rb
49
52
  - lib/active_harness/providers/PROVIDER_CONTRACT.md
50
53
  - lib/active_harness/providers/anthropic.rb
54
+ - lib/active_harness/providers/azure.rb
51
55
  - lib/active_harness/providers/base.rb
56
+ - lib/active_harness/providers/bedrock.rb
57
+ - lib/active_harness/providers/custom.rb
58
+ - lib/active_harness/providers/deepseek.rb
52
59
  - lib/active_harness/providers/gemini.rb
60
+ - lib/active_harness/providers/gpustack.rb
53
61
  - lib/active_harness/providers/groq.rb
62
+ - lib/active_harness/providers/mistral.rb
63
+ - lib/active_harness/providers/ollama.rb
54
64
  - lib/active_harness/providers/openai.rb
55
65
  - lib/active_harness/providers/openrouter.rb
66
+ - lib/active_harness/providers/perplexity.rb
67
+ - lib/active_harness/providers/vertexai.rb
68
+ - lib/active_harness/providers/xai.rb
56
69
  - lib/active_harness/railtie.rb
57
70
  - lib/active_harness/result.rb
58
71
  - lib/active_harness/tribunal.rb
@@ -62,6 +75,7 @@ files:
62
75
  - lib/generators/active_harness/install/templates/agents/support_agent.rb
63
76
  - lib/generators/active_harness/install/templates/agents/support_guard_agent.rb
64
77
  - lib/generators/active_harness/install/templates/controllers/ai_controller.rb
78
+ - lib/generators/active_harness/install/templates/initializers/active_harness.rb
65
79
  - lib/generators/active_harness/install/templates/memory/app_memory.rb
66
80
  - lib/generators/active_harness/install/templates/pipelines/support_pipeline.rb
67
81
  - lib/generators/active_harness/install/templates/prompts/support_guard_prompt.rb