Package com.tnsai.agents.interrupt
Record Class InterruptEvent.UserInterrupt
java.lang.Object
java.lang.Record
com.tnsai.agents.interrupt.InterruptEvent.UserInterrupt
- All Implemented Interfaces:
InterruptEvent
- Enclosing interface:
InterruptEvent
public static record InterruptEvent.UserInterrupt(String reason, Instant timestamp, String userId, boolean shouldCheckpoint)
extends Record
implements InterruptEvent
User-initiated interrupt (e.g., cancel button, Ctrl+C).
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.agents.interrupt.InterruptEvent
InterruptEvent.BudgetInterrupt, InterruptEvent.ErrorInterrupt, InterruptEvent.ExternalInterrupt, InterruptEvent.TimeoutInterrupt, InterruptEvent.UserInterrupt -
Constructor Summary
ConstructorsConstructorDescriptionUserInterrupt(String reason) UserInterrupt(String reason, String userId) UserInterrupt(String reason, Instant timestamp, String userId, boolean shouldCheckpoint) Creates an instance of aUserInterruptrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns true if the agent can be resumed after this interrupt.reason()Returns the value of thereasonrecord component.booleanReturns the value of theshouldCheckpointrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.userId()Returns the value of theuserIdrecord component.
-
Constructor Details
-
UserInterrupt
-
UserInterrupt
-
UserInterrupt
Creates an instance of aUserInterruptrecord class.- Parameters:
reason- the value for thereasonrecord componenttimestamp- the value for thetimestamprecord componentuserId- the value for theuserIdrecord componentshouldCheckpoint- the value for theshouldCheckpointrecord component
-
-
Method Details
-
isResumable
public boolean isResumable()Description copied from interface:InterruptEventReturns true if the agent can be resumed after this interrupt.- Specified by:
isResumablein interfaceInterruptEvent
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
reason
Returns the value of thereasonrecord component.- Specified by:
reasonin interfaceInterruptEvent- Returns:
- the value of the
reasonrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceInterruptEvent- Returns:
- the value of the
timestamprecord component
-
userId
Returns the value of theuserIdrecord component.- Returns:
- the value of the
userIdrecord component
-
shouldCheckpoint
public boolean shouldCheckpoint()Returns the value of theshouldCheckpointrecord component.- Specified by:
shouldCheckpointin interfaceInterruptEvent- Returns:
- the value of the
shouldCheckpointrecord component
-