Class: Roast::Workflow::Configuration
- Inherits:
-
Object
- Object
- Roast::Workflow::Configuration
- Defined in:
- lib/roast/workflow/configuration.rb
Overview
Encapsulates workflow configuration data and provides structured access to the configuration settings
Defined Under Namespace
Classes: MCPTool
Instance Attribute Summary collapse
-
#config_hash ⇒ Object
readonly
Returns the value of attribute config_hash.
-
#context_management ⇒ Object
readonly
Returns the value of attribute context_management.
-
#function_configs ⇒ Object
readonly
Returns the value of attribute function_configs.
-
#mcp_tools ⇒ Object
readonly
Returns the value of attribute mcp_tools.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#post_processing ⇒ Object
readonly
Returns the value of attribute post_processing.
-
#pre_processing ⇒ Object
readonly
Returns the value of attribute pre_processing.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#target ⇒ Object
Returns the value of attribute target.
-
#tool_configs ⇒ Object
readonly
Returns the value of attribute tool_configs.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
-
#workflow_path ⇒ Object
readonly
Returns the value of attribute workflow_path.
Instance Method Summary collapse
-
#api_token ⇒ Object
Delegate api_token to effective_token for backward compatibility.
- #basename ⇒ Object
- #context_path ⇒ Object
-
#find_step_index(steps_array = nil, target_step = nil) ⇒ Integer?
Find the index of a step in the workflow steps array.
-
#function_config(function_name) ⇒ Hash
Get configuration for a specific function.
- #get_step_config(step_name) ⇒ Object
- #has_target? ⇒ Boolean
-
#initialize(workflow_path, options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
-
#tool_config(tool_name) ⇒ Hash
Get configuration for a specific tool.
Constructor Details
#initialize(workflow_path, options = {}) ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/roast/workflow/configuration.rb', line 20 def initialize(workflow_path, = {}) @workflow_path = workflow_path # Load configuration using ConfigurationLoader @config_hash = ConfigurationLoader.load(workflow_path) # Extract basic configuration values @name = ConfigurationLoader.extract_name(@config_hash, workflow_path) @steps = ConfigurationLoader.extract_steps(@config_hash) @pre_processing = ConfigurationLoader.extract_pre_processing(@config_hash) @post_processing = ConfigurationLoader.extract_post_processing(@config_hash) @tools, @tool_configs = ConfigurationLoader.extract_tools(@config_hash) @mcp_tools = ConfigurationLoader.extract_mcp_tools(@config_hash) @function_configs = ConfigurationLoader.extract_functions(@config_hash) @model = ConfigurationLoader.extract_model(@config_hash) @context_management = ConfigurationLoader.extract_context_management(@config_hash) # Initialize components @api_configuration = ApiConfiguration.new(@config_hash) @step_finder = StepFinder.new(@steps) # Process target and resource @target = ConfigurationLoader.extract_target(@config_hash, ) process_resource end |
Instance Attribute Details
#config_hash ⇒ Object (readonly)
Returns the value of attribute config_hash.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def config_hash @config_hash end |
#context_management ⇒ Object (readonly)
Returns the value of attribute context_management.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def context_management @context_management end |
#function_configs ⇒ Object (readonly)
Returns the value of attribute function_configs.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def function_configs @function_configs end |
#mcp_tools ⇒ Object (readonly)
Returns the value of attribute mcp_tools.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def mcp_tools @mcp_tools end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def name @name end |
#post_processing ⇒ Object (readonly)
Returns the value of attribute post_processing.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def post_processing @post_processing end |
#pre_processing ⇒ Object (readonly)
Returns the value of attribute pre_processing.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def pre_processing @pre_processing end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def resource @resource end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def steps @steps end |
#target ⇒ Object
Returns the value of attribute target.
11 12 13 |
# File 'lib/roast/workflow/configuration.rb', line 11 def target @target end |
#tool_configs ⇒ Object (readonly)
Returns the value of attribute tool_configs.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def tool_configs @tool_configs end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def tools @tools end |
#workflow_path ⇒ Object (readonly)
Returns the value of attribute workflow_path.
10 11 12 |
# File 'lib/roast/workflow/configuration.rb', line 10 def workflow_path @workflow_path end |
Instance Method Details
#api_token ⇒ Object
Delegate api_token to effective_token for backward compatibility
16 17 18 |
# File 'lib/roast/workflow/configuration.rb', line 16 def api_token @api_configuration.effective_token end |
#basename ⇒ Object
50 51 52 |
# File 'lib/roast/workflow/configuration.rb', line 50 def basename @basename ||= File.basename(workflow_path, ".yml") end |
#context_path ⇒ Object
46 47 48 |
# File 'lib/roast/workflow/configuration.rb', line 46 def context_path @context_path ||= File.dirname(workflow_path) end |
#find_step_index(steps_array = nil, target_step = nil) ⇒ Integer?
Find the index of a step in the workflow steps array
66 67 68 69 70 71 72 73 74 |
# File 'lib/roast/workflow/configuration.rb', line 66 def find_step_index(steps_array = nil, target_step = nil) # Handle different call patterns for backward compatibility if steps_array.is_a?(String) && target_step.nil? target_step = steps_array steps_array = nil end @step_finder.find_index(target_step, steps_array) end |
#function_config(function_name) ⇒ Hash
Get configuration for a specific function
79 80 81 |
# File 'lib/roast/workflow/configuration.rb', line 79 def function_config(function_name) @function_configs[function_name.to_s] || {} end |
#get_step_config(step_name) ⇒ Object
58 59 60 |
# File 'lib/roast/workflow/configuration.rb', line 58 def get_step_config(step_name) @config_hash[step_name] || {} end |
#has_target? ⇒ Boolean
54 55 56 |
# File 'lib/roast/workflow/configuration.rb', line 54 def has_target? !target.nil? && !target.empty? end |
#tool_config(tool_name) ⇒ Hash
Get configuration for a specific tool
86 87 88 |
# File 'lib/roast/workflow/configuration.rb', line 86 def tool_config(tool_name) @tool_configs[tool_name.to_s] || {} end |