Class: Smith::Workflow::RunResult
- Inherits:
-
Struct
- Object
- Struct
- Smith::Workflow::RunResult
- Defined in:
- lib/smith/workflow.rb
Overview
‘keyword_init: true` is mandatory: `build_run_result` constructs the result via keyword arguments. Plain Ruby Structs treat the kwargs hash as the first positional field, silently leaving the remaining fields nil — verified empirically. The `keyword_init` flag routes kwargs to the right fields. `usage_entries` is the 10th field, added in this slice for hadithi billing.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#outcome ⇒ Object
Returns the value of attribute outcome.
-
#output ⇒ Object
Returns the value of attribute output.
-
#session_messages ⇒ Object
Returns the value of attribute session_messages.
-
#state ⇒ Object
Returns the value of attribute state.
-
#steps ⇒ Object
Returns the value of attribute steps.
-
#tool_results ⇒ Object
Returns the value of attribute tool_results.
-
#total_cost ⇒ Object
Returns the value of attribute total_cost.
-
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
-
#usage_entries ⇒ Object
Returns the value of attribute usage_entries.
Instance Method Summary collapse
- #done? ⇒ Boolean
- #failed? ⇒ Boolean
- #failed_transition ⇒ Object
- #failure_detail ⇒ Object
- #last_error ⇒ Object
- #outcome_kind ⇒ Object
- #outcome_payload ⇒ Object
- #terminal_output ⇒ Object
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def context @context end |
#outcome ⇒ Object
Returns the value of attribute outcome
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def outcome @outcome end |
#output ⇒ Object
Returns the value of attribute output
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def output @output end |
#session_messages ⇒ Object
Returns the value of attribute session_messages
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def @session_messages end |
#state ⇒ Object
Returns the value of attribute state
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def state @state end |
#steps ⇒ Object
Returns the value of attribute steps
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def steps @steps end |
#tool_results ⇒ Object
Returns the value of attribute tool_results
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def tool_results @tool_results end |
#total_cost ⇒ Object
Returns the value of attribute total_cost
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def total_cost @total_cost end |
#total_tokens ⇒ Object
Returns the value of attribute total_tokens
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def total_tokens @total_tokens end |
#usage_entries ⇒ Object
Returns the value of attribute usage_entries
30 31 32 |
# File 'lib/smith/workflow.rb', line 30 def usage_entries @usage_entries end |
Instance Method Details
#done? ⇒ Boolean
32 33 34 |
# File 'lib/smith/workflow.rb', line 32 def done? state == :done end |
#failed? ⇒ Boolean
36 37 38 |
# File 'lib/smith/workflow.rb', line 36 def failed? state == :failed end |
#failed_transition ⇒ Object
56 57 58 |
# File 'lib/smith/workflow.rb', line 56 def failed_transition failure_detail&.fetch(:transition) end |
#failure_detail ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/smith/workflow.rb', line 60 def failure_detail failed_step = steps.reverse.find { |step| step[:error] } return nil unless failed_step { transition: failed_step[:transition], from: failed_step[:from], to: failed_step[:to], error: failed_step[:error] } end |
#last_error ⇒ Object
52 53 54 |
# File 'lib/smith/workflow.rb', line 52 def last_error steps.reverse.map { |step| step[:error] }.compact.first end |
#outcome_kind ⇒ Object
44 45 46 |
# File 'lib/smith/workflow.rb', line 44 def outcome_kind outcome&.dig(:kind) end |
#outcome_payload ⇒ Object
48 49 50 |
# File 'lib/smith/workflow.rb', line 48 def outcome_payload outcome&.dig(:payload) end |
#terminal_output ⇒ Object
40 41 42 |
# File 'lib/smith/workflow.rb', line 40 def terminal_output output end |