Package com.tnsai.hooks.events
Record Class PostAction
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.PostAction
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the event was constructed (post-return)context- surrounding hook contextrequest- typed request that was dispatchedresponse- typed response from the executortype- dispatch channelelapsed- wall-clock time the action took
- All Implemented Interfaces:
ActionHookEvent,HookEvent
public record PostAction(String eventId, Instant timestamp, HookContext context, ActionRequest request, ActionResponse response, ActionType type, Duration elapsed)
extends Record
implements ActionHookEvent
Fires after an action returns successfully (issue #59). Counterpart
to
PreAction. Carries the typed ActionResponse and
wall-clock elapsed so metric / cost-accounting hooks can
compose measurements directly off the event stream.- Since:
- 0.5.0 (issue #59)
-
Constructor Summary
ConstructorsConstructorDescriptionPostAction(String eventId, Instant timestamp, HookContext context, ActionRequest request, ActionResponse response, ActionType type, Duration elapsed) Creates an instance of aPostActionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncontext()Returns the value of thecontextrecord component.elapsed()Returns the value of theelapsedrecord 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.final inthashCode()Returns a hash code value for this object.request()Returns the value of therequestrecord component.response()Returns the value of theresponserecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.withResponse(ActionResponse newResponse) Build a copy withnewResponsereplacingresponse.
-
Constructor Details
-
PostAction
public PostAction(String eventId, Instant timestamp, HookContext context, ActionRequest request, ActionResponse response, ActionType type, Duration elapsed) Creates an instance of aPostActionrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentrequest- the value for therequestrecord componentresponse- the value for theresponserecord componenttype- the value for thetyperecord componentelapsed- the value for theelapsedrecord 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. -
withResponse
Build a copy withnewResponsereplacingresponse. Used byModifyhooks that scrub the response (e.g. redaction on a PostAction carrying an LLM response). -
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. -
request
Returns the value of therequestrecord component.- Returns:
- the value of the
requestrecord component
-
response
Returns the value of theresponserecord component.- Returns:
- the value of the
responserecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
elapsed
Returns the value of theelapsedrecord component.- Returns:
- the value of the
elapsedrecord component
-