SessionHooks class
Lifecycle hooks for Copilot sessions.
Hooks are invoked by the CLI server at specific points during the agent's execution lifecycle.
Constructors
-
SessionHooks({HookHandler<
PreToolUseInput, PreToolUseOutput> ? onPreToolUse, HookHandler<PostToolUseInput, PostToolUseOutput> ? onPostToolUse, HookHandler<UserPromptSubmittedInput, UserPromptSubmittedOutput> ? onUserPromptSubmitted, HookHandler<SessionStartInput, SessionStartOutput> ? onSessionStart, HookHandler<SessionEndInput, SessionEndOutput> ? onSessionEnd, HookHandler<ErrorOccurredInput, ErrorOccurredOutput> ? onErrorOccurred}) -
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasHooks → bool
-
Whether any hooks are registered.
no setter
-
onErrorOccurred
→ HookHandler<
ErrorOccurredInput, ErrorOccurredOutput> ? -
Called when an error occurs.
final
-
onPostToolUse
→ HookHandler<
PostToolUseInput, PostToolUseOutput> ? -
Called after a tool completes. Can inspect or modify the result.
final
-
onPreToolUse
→ HookHandler<
PreToolUseInput, PreToolUseOutput> ? -
Called before a tool is executed. Can modify or reject the tool call.
final
-
onSessionEnd
→ HookHandler<
SessionEndInput, SessionEndOutput> ? -
Called when a session ends.
final
-
onSessionStart
→ HookHandler<
SessionStartInput, SessionStartOutput> ? -
Called when a session starts.
final
-
onUserPromptSubmitted
→ HookHandler<
UserPromptSubmittedInput, UserPromptSubmittedOutput> ? -
Called when the user submits a prompt.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
invoke(
String hookType, dynamic input, String sessionId) → Future - Dispatches a hook invocation by type.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited