Class: ClaudeHooks::MessageDisplay
- Defined in:
- lib/claude_hooks/message_display.rb
Overview
MessageDisplay runs while assistant message text is displayed on screen. Display-only: exit code and decision fields are ignored. The only effect is replacing the on-screen text via hookSpecificOutput.displayContent — the transcript and what Claude sees keep the original text.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#config, #input_data, #logger, #output, #output_data
Class Method Summary collapse
Instance Method Summary collapse
-
#delta ⇒ Object
The streamed assistant text delta for this event.
-
#display_content!(content) ⇒ Object
Replace the text shown on screen (display-only).
- #final ⇒ Object (also: #final?)
- #index ⇒ Object
- #message_id ⇒ Object
-
#message_text ⇒ Object
Some payloads expose the full text so far; kept as a convenience reader.
-
#turn_id ⇒ Object
INPUT DATA ACCESS ===.
Methods inherited from Base
#agent_id, #agent_type, #allow_continue!, #base_dir, #call, #clear_specifics!, #clear_system_message!, #cwd, #effort, #home_claude_dir, #home_path_for, #hook_event_name, #hook_type, #initialize, #log, #output_and_exit, #path_for, #permission_mode, #prevent_continue!, #project_claude_dir, #project_path_for, #prompt_id, #read_transcript, #session_id, #show_output!, #stringify_output, #suppress_output!, #system_message!, #terminal_sequence, #terminal_sequence!, #transcript_path
Constructor Details
This class inherits a constructor from ClaudeHooks::Base
Class Method Details
.hook_type ⇒ Object
11 12 13 |
# File 'lib/claude_hooks/message_display.rb', line 11 def self.hook_type 'MessageDisplay' end |
.input_fields ⇒ Object
15 16 17 |
# File 'lib/claude_hooks/message_display.rb', line 15 def self.input_fields %w[turn_id message_id index final delta] end |
Instance Method Details
#delta ⇒ Object
The streamed assistant text delta for this event.
39 40 41 |
# File 'lib/claude_hooks/message_display.rb', line 39 def delta @input_data['delta'] end |
#display_content!(content) ⇒ Object
Replace the text shown on screen (display-only).
51 52 53 54 55 56 |
# File 'lib/claude_hooks/message_display.rb', line 51 def display_content!(content) @output_data['hookSpecificOutput'] = { 'hookEventName' => hook_event_name, 'displayContent' => content } end |
#final ⇒ Object Also known as: final?
33 34 35 |
# File 'lib/claude_hooks/message_display.rb', line 33 def final @input_data.key?('final') ? @input_data['final'] : @input_data['isFinal'] end |
#index ⇒ Object
29 30 31 |
# File 'lib/claude_hooks/message_display.rb', line 29 def index @input_data['index'] end |
#message_id ⇒ Object
25 26 27 |
# File 'lib/claude_hooks/message_display.rb', line 25 def @input_data['message_id'] || @input_data['messageId'] end |
#message_text ⇒ Object
Some payloads expose the full text so far; kept as a convenience reader.
44 45 46 |
# File 'lib/claude_hooks/message_display.rb', line 44 def @input_data['message_text'] || @input_data['messageText'] end |
#turn_id ⇒ Object
INPUT DATA ACCESS ===
21 22 23 |
# File 'lib/claude_hooks/message_display.rb', line 21 def turn_id @input_data['turn_id'] || @input_data['turnId'] end |