Record Class ToolRun

java.lang.Object
java.lang.Record
com.github.sormuras.bach.ToolRun
Record Components:
name - the name of the tool
args - the arguments of the tool run
thread - the ID of the thread that ran the tool
duration - the duration of the tool run
code - the exit code of the tool run
output - the normal and expected output of the tool run
errors - the error message of the tool run

public record ToolRun(String name, List<String> args, long thread, Duration duration, int code, String output, String errors) extends Record
A record of a tool run.
  • Constructor Details

    • ToolRun

      public ToolRun(String name, List<String> args, long thread, Duration duration, int code, String output, String errors)
      Creates an instance of a ToolRun record class.
      Parameters:
      name - the value for the name record component
      args - the value for the args record component
      thread - the value for the thread record component
      duration - the value for the duration record component
      code - the value for the code record component
      output - the value for the output record component
      errors - the value for the errors record component
  • Method Details

    • isError

      public boolean isError()
      Returns true if this response represents an errored tool call run.
      Returns:
      true if this response represents an errored tool call run
    • isSuccessful

      public boolean isSuccessful()
      Returns true if this response represents a successful tool call run.
      Returns:
      true if this response represents a successful tool call run
    • requireSuccessful

      Returns silently this instance if it represents a successful tool call run.
      Returns:
      silently this instance if it represents a successful tool call run
      Throws:
      RuntimeException - if isError() returns true
    • visit

      public ToolRun visit(ToolRun.Visitor visitor)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • args

      public List<String> args()
      Returns the value of the args record component.
      Returns:
      the value of the args record component
    • thread

      public long thread()
      Returns the value of the thread record component.
      Returns:
      the value of the thread record component
    • duration

      public Duration duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • code

      public int code()
      Returns the value of the code record component.
      Returns:
      the value of the code record component
    • output

      public String output()
      Returns the value of the output record component.
      Returns:
      the value of the output record component
    • errors

      public String errors()
      Returns the value of the errors record component.
      Returns:
      the value of the errors record component