Class: RosettAi::Workflow::StepRunner
- Inherits:
-
Object
- Object
- RosettAi::Workflow::StepRunner
- Defined in:
- lib/rosett_ai/workflow/step_runner.rb
Overview
Dispatches workflow step definitions to the appropriate step class.
Maps step type strings to step implementations and handles step-level error recovery (on_failure: continue vs stop).
Constant Summary collapse
- STEP_TYPES =
{ 'shell' => Steps::ShellStep, 'rai' => Steps::RaiStep, 'prompt' => Steps::PromptStep }.freeze
Instance Method Summary collapse
-
#describe(step_def) ⇒ String
Returns a description string for dry-run mode.
-
#run(step_def) ⇒ Hash
Executes a single step definition.
Instance Method Details
#describe(step_def) ⇒ String
Returns a description string for dry-run mode.
45 46 47 48 49 |
# File 'lib/rosett_ai/workflow/step_runner.rb', line 45 def describe(step_def) step_class = resolve_step_class(step_def) step = step_class.new(step_def) step.describe end |
#run(step_def) ⇒ Hash
Executes a single step definition.
31 32 33 34 35 36 37 38 39 |
# File 'lib/rosett_ai/workflow/step_runner.rb', line 31 def run(step_def) step_class = resolve_step_class(step_def) step = step_class.new(step_def) step.execute rescue RosettAi::WorkflowError raise rescue StandardError => e { status: 'fail', message: "Step '#{step_def['name']}' raised: #{e.}", duration_ms: 0.0 } end |