Package com.tnsai.hooks.events
Record Class OnNotification
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.OnNotification
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the agent issued the notificationcontext- surrounding hook contextkind- category of notificationmessage- human-readable textexpectedWait- optional "this will take about N" hint — useful forNotificationKind.LONG_RUNNING
- All Implemented Interfaces:
ChatHookEvent,HookEvent
public record OnNotification(String eventId, Instant timestamp, HookContext context, NotificationKind kind, String message, Optional<Duration> expectedWait)
extends Record
implements ChatHookEvent
Fires when an agent needs user attention (issue #60): a confirmation
prompt, a long-running status update, an error the user should see
asynchronously, or an idle re-engagement signal. A
NotificationRouterHook (follow-up) typically consumes these
and routes to the right channel (current chat, Telegram, email, Slack).- Since:
- 0.5.0 (issue #60)
-
Constructor Summary
ConstructorsConstructorDescriptionOnNotification(String eventId, Instant timestamp, HookContext context, NotificationKind kind, String message, Optional<Duration> expectedWait) Creates an instance of aOnNotificationrecord 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.Returns the value of theexpectedWaitrecord component.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.message()Returns the value of themessagerecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
OnNotification
public OnNotification(String eventId, Instant timestamp, HookContext context, NotificationKind kind, String message, Optional<Duration> expectedWait) Creates an instance of aOnNotificationrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentkind- the value for thekindrecord componentmessage- the value for themessagerecord componentexpectedWait- the value for theexpectedWaitrecord 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. -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
expectedWait
Returns the value of theexpectedWaitrecord component.- Returns:
- the value of the
expectedWaitrecord component
-