Class: Aidp::StrategyExecution::StrategySpec
- Inherits:
-
Object
- Object
- Aidp::StrategyExecution::StrategySpec
- Defined in:
- lib/aidp/strategy_execution/strategy_spec.rb
Constant Summary collapse
- DEFAULT_MAX_DEPTH =
1- DEFAULT_FANOUT =
1- DEFAULT_MERGE_POLICY =
"highest_score"
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
-
#evaluators ⇒ Object
readonly
Returns the value of attribute evaluators.
-
#fanout ⇒ Object
readonly
Returns the value of attribute fanout.
-
#max_depth ⇒ Object
readonly
Returns the value of attribute max_depth.
-
#merge_policy ⇒ Object
readonly
Returns the value of attribute merge_policy.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#timeouts ⇒ Object
readonly
Returns the value of attribute timeouts.
Class Method Summary collapse
Instance Method Summary collapse
- #branch_commands ⇒ Object
- #evaluator_definitions ⇒ Object
-
#initialize(data) ⇒ StrategySpec
constructor
A new instance of StrategySpec.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ StrategySpec
Returns a new instance of StrategySpec.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 16 def initialize(data) @name = fetch_name(data) @max_depth = positive_integer(data[:max_depth], DEFAULT_MAX_DEPTH) @fanout = positive_integer(data[:fanout], DEFAULT_FANOUT) @agents = normalize_agents(data[:agents] || {}) @evaluators = normalize_evaluators(data[:evaluators] || []) @merge_policy = (data[:merge_policy] || DEFAULT_MERGE_POLICY).to_s @constraints = (data[:constraints] || {}).transform_keys(&:to_sym) @timeouts = (data[:timeouts] || {}).transform_keys(&:to_sym) ensure_runnable! end |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def agents @agents end |
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def constraints @constraints end |
#evaluators ⇒ Object (readonly)
Returns the value of attribute evaluators.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def evaluators @evaluators end |
#fanout ⇒ Object (readonly)
Returns the value of attribute fanout.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def fanout @fanout end |
#max_depth ⇒ Object (readonly)
Returns the value of attribute max_depth.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def max_depth @max_depth end |
#merge_policy ⇒ Object (readonly)
Returns the value of attribute merge_policy.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def merge_policy @merge_policy end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def name @name end |
#timeouts ⇒ Object (readonly)
Returns the value of attribute timeouts.
10 11 12 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 10 def timeouts @timeouts end |
Class Method Details
.from_hash(data) ⇒ Object
12 13 14 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 12 def self.from_hash(data) new(data.transform_keys(&:to_sym)) end |
Instance Method Details
#branch_commands ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 41 def branch_commands commands = candidate_agent_commands Array.new(fanout) do |index| command = commands[index % commands.length] { key: "branch_#{index}", name: command[:name], command: command[:command] } end end |
#evaluator_definitions ⇒ Object
53 54 55 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 53 def evaluator_definitions evaluators end |
#to_h ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/aidp/strategy_execution/strategy_spec.rb', line 28 def to_h { name: name, max_depth: max_depth, fanout: fanout, agents: agents, evaluators: evaluators, merge_policy: merge_policy, constraints: constraints, timeouts: timeouts } end |