Package com.tnsai.hooks.events
Record Class OnCapabilityDispatch
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.OnCapabilityDispatch
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the dispatch was about to occurcontext- surrounding hook contextcapabilityInterface- fully-qualified name of the@CapabilityinterfacemethodName- method name being dispatchedargs- positional arguments to the call (immutable copy)dispatchType- whichActionTypechannel routed the call (LOCAL,LLM, …)
- All Implemented Interfaces:
CapabilityHookEvent,HookEvent
public record OnCapabilityDispatch(String eventId, Instant timestamp, HookContext context, String capabilityInterface, String methodName, List<Object> args, ActionType dispatchType)
extends Record
implements CapabilityHookEvent
Fires when
ActionExecutor dispatches a method that
originated from a @Capability interface (issue #60).
Use for capability-level audit, usage metrics, per-capability
rate-limiting — concerns that span every role implementing the
capability without each role having to know about them.
args is captured as List<Object> matching the
dispatcher's reflective call shape. Implementations should treat
the list as opaque and avoid mutating it.
- Since:
- 0.5.0 (issue #60)
-
Constructor Summary
ConstructorsConstructorDescriptionOnCapabilityDispatch(String eventId, Instant timestamp, HookContext context, String capabilityInterface, String methodName, List<Object> args, ActionType dispatchType) Creates an instance of aOnCapabilityDispatchrecord class. -
Method Summary
Modifier and TypeMethodDescriptionargs()Returns the value of theargsrecord component.Returns the value of thecapabilityInterfacerecord component.context()Returns the value of thecontextrecord component.Returns the value of thedispatchTyperecord 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.Returns the value of themethodNamerecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OnCapabilityDispatch
public OnCapabilityDispatch(String eventId, Instant timestamp, HookContext context, String capabilityInterface, String methodName, List<Object> args, ActionType dispatchType) Creates an instance of aOnCapabilityDispatchrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentcapabilityInterface- the value for thecapabilityInterfacerecord componentmethodName- the value for themethodNamerecord componentargs- the value for theargsrecord componentdispatchType- the value for thedispatchTyperecord 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. -
capabilityInterface
Returns the value of thecapabilityInterfacerecord component.- Returns:
- the value of the
capabilityInterfacerecord component
-
methodName
Returns the value of themethodNamerecord component.- Returns:
- the value of the
methodNamerecord component
-
args
Returns the value of theargsrecord component.- Returns:
- the value of the
argsrecord component
-
dispatchType
Returns the value of thedispatchTyperecord component.- Returns:
- the value of the
dispatchTyperecord component
-