Class: Mistri::Result
- Inherits:
-
Data
- Object
- Data
- Mistri::Result
- Defined in:
- lib/mistri/result.rb
Overview
The outcome of a run. A run either finishes, or suspends because a tool needs a human's approval, or stops on abort or budget. Suspension is a first-class outcome, not an error: the run returns immediately with awaiting_approval? true and the pending calls, so nothing blocks waiting for a decision that may come days later.
Reads delegate to the final message, so result.text works whether the run completed or suspended. output is a task's validated value, nil on plain runs. usage is the run's own accounting: every persisted turn plus compaction calls, summed (a resumed run counts from the resume; task sums across its fix passes).
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#pending ⇒ Object
readonly
Returns the value of attribute pending.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #aborted? ⇒ Boolean
- #awaiting_approval? ⇒ Boolean
- #completed? ⇒ Boolean
- #error_message ⇒ Object
- #errored? ⇒ Boolean
-
#initialize(message:, status:, pending: [], output: nil, usage: Usage.zero) ⇒ Result
constructor
A new instance of Result.
- #stop_reason ⇒ Object
- #stopped_by_budget? ⇒ Boolean
- #text ⇒ Object
- #to_s ⇒ Object
- #tool_calls ⇒ Object
Constructor Details
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message
15 16 17 |
# File 'lib/mistri/result.rb', line 15 def @message end |
#output ⇒ Object (readonly)
Returns the value of attribute output
15 16 17 |
# File 'lib/mistri/result.rb', line 15 def output @output end |
#pending ⇒ Object (readonly)
Returns the value of attribute pending
15 16 17 |
# File 'lib/mistri/result.rb', line 15 def pending @pending end |
#status ⇒ Object (readonly)
Returns the value of attribute status
15 16 17 |
# File 'lib/mistri/result.rb', line 15 def status @status end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage
15 16 17 |
# File 'lib/mistri/result.rb', line 15 def usage @usage end |
Instance Method Details
#aborted? ⇒ Boolean
22 |
# File 'lib/mistri/result.rb', line 22 def aborted? = status == :aborted |
#awaiting_approval? ⇒ Boolean
21 |
# File 'lib/mistri/result.rb', line 21 def awaiting_approval? = status == :awaiting_approval |
#completed? ⇒ Boolean
20 |
# File 'lib/mistri/result.rb', line 20 def completed? = status == :completed |
#error_message ⇒ Object
28 |
# File 'lib/mistri/result.rb', line 28 def = &. |
#errored? ⇒ Boolean
24 |
# File 'lib/mistri/result.rb', line 24 def errored? = status == :error |
#stop_reason ⇒ Object
27 |
# File 'lib/mistri/result.rb', line 27 def stop_reason = &.stop_reason |
#stopped_by_budget? ⇒ Boolean
23 |
# File 'lib/mistri/result.rb', line 23 def stopped_by_budget? = status == :budget |
#text ⇒ Object
26 |
# File 'lib/mistri/result.rb', line 26 def text = &.text |
#to_s ⇒ Object
30 |
# File 'lib/mistri/result.rb', line 30 def to_s = text.to_s |
#tool_calls ⇒ Object
29 |
# File 'lib/mistri/result.rb', line 29 def tool_calls = ? .tool_calls : [] |