Package com.tnsai.hooks.events
Record Class OnStateTransition
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.OnStateTransition
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the transition occurredcontext- surrounding hook contextfrom- previous state;nullonly for the initial transition out of pre-built stateto- new statetrigger- short label describing the trigger
- All Implemented Interfaces:
AgentHookEvent,HookEvent
public record OnStateTransition(String eventId, Instant timestamp, HookContext context, AgentState from, AgentState to, String trigger)
extends Record
implements AgentHookEvent
Fires on an agent FSM state change (issue #60).
Today every agent has only one visible state —
— so the only transition possible is
invalid reference
AgentState#READYnull → READY at init; the orchestrator (follow-up) fires
that synthetic transition so consumers can bind against the final
hook API even before the full FSM from #21 lands. Adding states to
AgentState in #21 automatically extends the transitions
this event can carry.
trigger is a short stable label describing what caused
the transition ("build_complete", "chat_start",
"error" …). Used in audit logs + dashboards.
- Since:
- 0.5.0 (issue #60)
-
Constructor Summary
ConstructorsConstructorDescriptionOnStateTransition(String eventId, Instant timestamp, HookContext context, AgentState from, AgentState to, String trigger) Creates an instance of aOnStateTransitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncontext()Returns the value of thecontextrecord component.final booleanIndicates whether some other object is "equal to" this one.eventId()Returns the value of theeventIdrecord component.Short stable string identifier of the event kind, e.g.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thetimestamprecord component.to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.trigger()Returns the value of thetriggerrecord component.
-
Constructor Details
-
OnStateTransition
public OnStateTransition(String eventId, Instant timestamp, HookContext context, AgentState from, AgentState to, String trigger) Creates an instance of aOnStateTransitionrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentfrom- the value for thefromrecord componentto- the value for thetorecord componenttrigger- the value for thetriggerrecord component
-
-
Method Details
-
eventType
Description copied from interface:HookEventShort stable string identifier of the event kind, e.g."PreToolUse". Default implementation derives it from the concrete record's simple class name; concrete records may override if a different naming is desirable. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
eventId
Returns the value of theeventIdrecord component. -
timestamp
Returns the value of thetimestamprecord component. -
context
Returns the value of thecontextrecord component. -
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-
trigger
Returns the value of thetriggerrecord component.- Returns:
- the value of the
triggerrecord component
-