Package com.tnsai.hooks.events
Record Class SessionStart
java.lang.Object
java.lang.Record
com.tnsai.hooks.events.SessionStart
- Record Components:
eventId- ULID-shaped correlation idtimestamp- when the connection openedcontext- surrounding hook contextsessionId- framework session id (matches the correspondingSessionEnd)clientAddress- client IP / address, or "unknown" when unavailableheaders- transport-level headers (immutable copy)authToken- opaque auth token if present in the headersprotocol- transport protocol used by this session
- All Implemented Interfaces:
HookEvent,SessionHookEvent
public record SessionStart(String eventId, Instant timestamp, HookContext context, String sessionId, String clientAddress, Map<String,String> headers, Optional<String> authToken, SessionProtocol protocol)
extends Record
implements SessionHookEvent
Fires when a new client session opens on the server (issue #63).
The natural point for authentication, tenant resolution, and
per-session rate-limit setup.
Hooks may Block to
refuse the connection (the server returns a structured auth /
policy error to the client) or Modify
via withHeaders(Map) to rewrite headers (e.g. resolve a
raw token into a tenant id before the session proceeds).
- Since:
- 0.5.0 (issue #63)
-
Constructor Summary
ConstructorsConstructorDescriptionSessionStart(String eventId, Instant timestamp, HookContext context, String sessionId, String clientAddress, Map<String, String> headers, Optional<String> authToken, SessionProtocol protocol) Creates an instance of aSessionStartrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theauthTokenrecord component.Returns the value of theclientAddressrecord component.context()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.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.protocol()Returns the value of theprotocolrecord component.Returns the value of thesessionIdrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.withHeaders(Map<String, String> newHeaders) Build a copy withnewHeadersreplacingheaders.
-
Constructor Details
-
SessionStart
public SessionStart(String eventId, Instant timestamp, HookContext context, String sessionId, String clientAddress, Map<String, String> headers, Optional<String> authToken, SessionProtocol protocol) Creates an instance of aSessionStartrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componentcontext- the value for thecontextrecord componentsessionId- the value for thesessionIdrecord componentclientAddress- the value for theclientAddressrecord componentheaders- the value for theheadersrecord componentauthToken- the value for theauthTokenrecord componentprotocol- the value for theprotocolrecord 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. -
withHeaders
Build a copy withnewHeadersreplacingheaders. Used by Modify hooks that resolve auth headers into derived fields (e.g.tenantId) before the session proceeds. -
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. -
sessionId
Returns the value of thesessionIdrecord component.- Returns:
- the value of the
sessionIdrecord component
-
clientAddress
Returns the value of theclientAddressrecord component.- Returns:
- the value of the
clientAddressrecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
authToken
Returns the value of theauthTokenrecord component.- Returns:
- the value of the
authTokenrecord component
-
protocol
Returns the value of theprotocolrecord component.- Returns:
- the value of the
protocolrecord component
-