Class: RosettAi::Workflow::StepRunner

Inherits:
Object
  • Object
show all
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).

Author:

  • hugo

  • claude

Constant Summary collapse

STEP_TYPES =
{
  'shell' => Steps::ShellStep,
  'rai' => Steps::RaiStep,
  'prompt' => Steps::PromptStep
}.freeze

Instance Method Summary collapse

Instance Method Details

#describe(step_def) ⇒ String

Returns a description string for dry-run mode.

Parameters:

  • step_def (Hash)

    step definition from workflow YAML

Returns:

  • (String)

    human-readable step description



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.

Parameters:

  • step_def (Hash)

    step definition from workflow YAML

Returns:

  • (Hash)

    execution result with :status, :message, :duration_ms

Raises:



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.message}", duration_ms: 0.0 }
end