MessageHookContext class
Context for message-related hooks (HookType.preMessage, HookType.postMessage).
- Inheritance
-
- Object
- HookContext
- MessageHookContext
Constructors
-
MessageHookContext({required HookType hookType, required DateTime timestamp, String? sessionId, Map<
String, dynamic> metadata = const {}, List<HookResult> previousResults = const [], int? turnIndex, required String role, required String content, required int messageTurnIndex, List<Map< ? toolUseBlocks, bool? hasStopSequence})String, dynamic> > -
const
Properties
- content → String
-
Text content of the message.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasStopSequence → bool?
-
Whether this message contains a stop sequence.
final
- hookType → HookType
-
The type of hook being executed.
finalinherited
- messageTurnIndex → int
-
Position of this message in the conversation turn sequence.
final
-
metadata
→ Map<
String, dynamic> -
Arbitrary metadata that hooks can read and contribute to.
finalinherited
-
previousResults
→ List<
HookResult> -
Results from previously executed hooks in the same chain.
finalinherited
- role → String
-
Role of the message sender (user, assistant, system).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionId → String?
-
The active session ID, if any.
finalinherited
- timestamp → DateTime
-
When this hook execution was initiated.
finalinherited
-
toolUseBlocks
→ List<
Map< ?String, dynamic> > -
Optional list of tool use blocks in the message.
final
- turnIndex → int?
-
The current conversation turn index, if applicable.
finalinherited
Methods
-
copyWith(
{HookType? hookType, DateTime? timestamp, String? sessionId, Map< String, dynamic> ? metadata, List<HookResult> ? previousResults, int? turnIndex}) → HookContext -
Create a copy with updated fields.
inherited
-
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