active_harness 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e783d19115a6a083487eaf4570ce063460ef736458665c9e4c60a52a31f62db3
4
- data.tar.gz: 103c07efebcef464b357740b340eca95384b84f68ca5894c6f41905f37e29260
3
+ metadata.gz: e13cc7f12afbddbea9116cae2b3f5c571386ff21a5d7246107a62ceadc3253be
4
+ data.tar.gz: 8f4cdcf1333b9f10acdd664e36568e741bf09652f4b8898d028dc3bf601024d9
5
5
  SHA512:
6
- metadata.gz: 2bc1718f6a9e1b0a352fbdc5f174da5a1db495ce7d4c9099e34f1eaa90e4c0ae7a5f1addd769918707240667d69508ed13408effc450091773cb3aa346961efd
7
- data.tar.gz: bf5609cf62b4227b2604f4c1c5bc03c51e88ae1bfe7b07575c1d988cb2618906dcb63555049aca295a9d772132a62a437cd7345ee30cad27c0cb53a8a9b75d08
6
+ metadata.gz: bf13a6f23ac3053316b31890505d39369bb2e932def11dcc7ecdcb2e948aed9466f91d9b1fe1b356dba35112698f7d2e901f1971e93356f32a3b34743d731e7c
7
+ data.tar.gz: 43e7202af753ffd6c6761f21ba2543498c6d04c70e52a57fb9c1aa2cb5063922f536036e28e99bc7710f7e079c50a19839ad510b97ba33841a6d6ff7b15d3220
@@ -94,6 +94,7 @@ module ActiveHarness
94
94
  end
95
95
  end
96
96
 
97
+ attr_accessor :input
97
98
  attr_reader :results, :errors, :verdict, :execution_time, :agent_execution_times
98
99
 
99
100
  def initialize(input: nil, context: {}, agents: nil, timeout: 7)
@@ -0,0 +1,16 @@
1
+ require "rails/generators"
2
+
3
+ module ActiveHarness
4
+ module Generators
5
+ class AgentGenerator < Rails::Generators::NamedBase
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ desc "Creates an ActiveHarness agent in app/ai/agents/"
9
+
10
+ def create_agent
11
+ template "agent.rb.tt",
12
+ "app/ai/agents/#{file_name}_agent.rb"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ class <%= class_name %>Agent < ActiveHarness::Agent
2
+ system_prompt <%= class_name %>Prompt
3
+
4
+ model do
5
+ use provider: :openrouter, model: "mistralai/mistral-nemo"
6
+ fallback provider: :openrouter, model: "meta-llama/llama-3.1-8b-instruct"
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ require "rails/generators"
2
+
3
+ module ActiveHarness
4
+ module Generators
5
+ class MemoryGenerator < Rails::Generators::NamedBase
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ desc "Creates an ActiveHarness memory class in app/ai/memory/"
9
+
10
+ def create_memory
11
+ template "memory.rb.tt",
12
+ "app/ai/memory/#{file_name}_memory.rb"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ class <%= class_name %>Memory < ActiveHarness::Memory
2
+ def initialize(session_id:)
3
+ super(
4
+ session_id: session_id,
5
+ depth: 10,
6
+ adapter: :file,
7
+ path: Rails.root.join("storage", "ai", "memory").to_s,
8
+ storage_size: 200,
9
+ pretty: Rails.env.development?
10
+ )
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ require "rails/generators"
2
+
3
+ module ActiveHarness
4
+ module Generators
5
+ class PipelineGenerator < Rails::Generators::NamedBase
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ desc "Creates an ActiveHarness pipeline in app/ai/pipelines/"
9
+
10
+ def create_pipeline
11
+ template "pipeline.rb.tt",
12
+ "app/ai/pipelines/#{file_name}_pipeline.rb"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ class <%= class_name %>Pipeline < ActiveHarness::Pipeline
2
+ step :respond, <%= class_name %>Agent
3
+
4
+ before :step do |step_name, _payload|
5
+ puts "[pipeline] → :#{step_name}"
6
+ end
7
+
8
+ after :step do |step_name, _result|
9
+ puts "[pipeline] ✓ :#{step_name}"
10
+ end
11
+
12
+ callback :stopped do |step_name, _result|
13
+ puts "[pipeline] ✗ STOPPED at :#{step_name}"
14
+ end
15
+
16
+ callback :complete do |_last_result|
17
+ puts "[pipeline] ✓ complete"
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ require "rails/generators"
2
+
3
+ module ActiveHarness
4
+ module Generators
5
+ class PromptGenerator < Rails::Generators::NamedBase
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ desc "Creates an ActiveHarness prompt in app/ai/prompts/"
9
+
10
+ def create_prompt
11
+ template "prompt.rb.tt",
12
+ "app/ai/prompts/#{file_name}_prompt.rb"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ class <%= class_name %>Prompt
2
+ def call
3
+ "You are a concise and helpful assistant. Answer in 1-2 sentences."
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class <%= class_name %>Tribunal < ActiveHarness::Tribunal
2
+ agents <%= class_name %>Agent
3
+
4
+ process do |results|
5
+ results.all? { |r| r.parsed["result"] == true }
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ require "rails/generators"
2
+
3
+ module ActiveHarness
4
+ module Generators
5
+ class TribunalGenerator < Rails::Generators::NamedBase
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ desc "Creates an ActiveHarness tribunal in app/ai/tribunals/"
9
+
10
+ def create_tribunal
11
+ template "tribunal.rb.tt",
12
+ "app/ai/tribunals/#{file_name}_tribunal.rb"
13
+ end
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - the-teacher
@@ -56,6 +56,8 @@ files:
56
56
  - lib/active_harness/railtie.rb
57
57
  - lib/active_harness/result.rb
58
58
  - lib/active_harness/tribunal.rb
59
+ - lib/generators/active_harness/agent/agent_generator.rb
60
+ - lib/generators/active_harness/agent/templates/agent.rb.tt
59
61
  - lib/generators/active_harness/install/install_generator.rb
60
62
  - lib/generators/active_harness/install/templates/agents/test_support_agent.rb
61
63
  - lib/generators/active_harness/install/templates/agents/test_support_guard_agent.rb
@@ -65,6 +67,14 @@ files:
65
67
  - lib/generators/active_harness/install/templates/prompts/test_support_guard_prompt.rb
66
68
  - lib/generators/active_harness/install/templates/prompts/test_support_prompt.rb
67
69
  - lib/generators/active_harness/install/templates/tribunals/test_support_guard_tribunal.rb
70
+ - lib/generators/active_harness/memory/memory_generator.rb
71
+ - lib/generators/active_harness/memory/templates/memory.rb.tt
72
+ - lib/generators/active_harness/pipeline/pipeline_generator.rb
73
+ - lib/generators/active_harness/pipeline/templates/pipeline.rb.tt
74
+ - lib/generators/active_harness/prompt/prompt_generator.rb
75
+ - lib/generators/active_harness/prompt/templates/prompt.rb.tt
76
+ - lib/generators/active_harness/tribunal/templates/tribunal.rb.tt
77
+ - lib/generators/active_harness/tribunal/tribunal_generator.rb
68
78
  homepage: https://github.com/the-teacher/active_harness
69
79
  licenses:
70
80
  - MIT