Record Class ReplayStep

java.lang.Object
java.lang.Record
com.tnsai.session.replay.ReplayStep

public record ReplayStep(int index, ConversationTurn turn, String description, Duration elapsedTime, boolean isFirst, boolean isLast) extends Record
Represents a single step in a session replay.

Each step contains the original conversation turn along with metadata useful for replay and analysis.

Author:
TnsAI Team
  • Constructor Details

    • ReplayStep

      public ReplayStep(int index, ConversationTurn turn, String description, Duration elapsedTime, boolean isFirst, boolean isLast)
      Creates an instance of a ReplayStep record class.
      Parameters:
      index - the value for the index record component
      turn - the value for the turn record component
      description - the value for the description record component
      elapsedTime - the value for the elapsedTime record component
      isFirst - the value for the isFirst record component
      isLast - the value for the isLast record component
  • Method Details

    • of

      public static ReplayStep of(int index, ConversationTurn turn, Duration elapsedTime, int totalSteps)
      Creates a replay step.
      Parameters:
      index - the step index
      turn - the conversation turn
      elapsedTime - time since session start
      totalSteps - total number of steps
      Returns:
      the replay step
    • type

      public TurnType type()
      Gets the turn type.
    • content

      public String content()
      Gets the turn content.
    • contentPreview

      public String contentPreview(int maxLength)
      Gets a truncated version of the content.
      Parameters:
      maxLength - maximum length
      Returns:
      truncated content
    • isUserMessage

      public boolean isUserMessage()
      Checks if this is a user message.
    • isAssistantMessage

      public boolean isAssistantMessage()
      Checks if this is an assistant message.
    • isToolCall

      public boolean isToolCall()
      Checks if this is a tool call.
    • isToolResult

      public boolean isToolResult()
      Checks if this is a tool result.
    • getToolName

      public String getToolName()
      Gets the tool name if this is a tool-related step.
    • 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.
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • turn

      public ConversationTurn turn()
      Returns the value of the turn record component.
      Returns:
      the value of the turn record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • elapsedTime

      public Duration elapsedTime()
      Returns the value of the elapsedTime record component.
      Returns:
      the value of the elapsedTime record component
    • isFirst

      public boolean isFirst()
      Returns the value of the isFirst record component.
      Returns:
      the value of the isFirst record component
    • isLast

      public boolean isLast()
      Returns the value of the isLast record component.
      Returns:
      the value of the isLast record component