You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(parser): display all hook types in GUI (Stop, PreToolUse, PostToolUse, etc.) (#23)
* fix(parser): rescue stop_hook_summary and Stop hook feedback entries as HookMsg
Verified via --debug output and live JSONL inspection:
The actual hook entry format written to JSONL session files is:
{type:"system", subtype:"stop_hook_summary", hookCount:N,
hookInfos:[{command, durationMs}], preventedContinuation, ...}
This is written on EVERY Stop hook invocation (success or failure).
Previous code only rescued type:"progress" data.type:"hook_progress" entries,
which never appear in JSONL files — so hooks were never displayed.
When a Stop hook exits non-zero, Claude also injects a user meta entry:
{type:"user", isMeta:true, message:{content:"Stop hook feedback:\n[cmd]: output"}}
Both are now rescued before the NOISE_ENTRY_TYPES filter:
- system/stop_hook_summary (hookCount > 0) → HookMsg with hook_event:"Stop"
and hook_name extracted from hookInfos[0].command
- system/hook_progress → HookMsg (verbose/stream-json mode)
- user/isMeta "Stop hook feedback:" → HookMsg with parsed command and output
New Entry fields: hookCount, hookInfos, preventedContinuation.
Three new tests: stop_hook_summary rescue, zero-hook drop, feedback entry rescue.
https://claude.ai/code/session_01MK63kGRSmtkGSXCDaqh8p3
* fix(parser): rescue attachment hook entries for PreToolUse/PostToolUse and all other hook events
Verified from cli.js bundle (v2.1.86):
All non-Stop hook events (PreToolUse, PostToolUse, PostToolUseFailure,
UserPromptSubmit, Notification, SessionStart, etc.) write their results
to the JSONL session file as type:"attachment" entries:
{type:"attachment", uuid, timestamp,
attachment:{type:"hook_success"|"hook_non_blocking_error"|
"hook_blocking_error"|"hook_cancelled",
hookEvent, hookName, toolUseID, ...}}
These were previously dropped because Entry had no attachment field
and the empty-role fallback silently discarded them.
Fix: add attachment: Option<Value> to Entry, rescue attachment entries
where attachment.hookEvent is non-empty as HookMsg. Blocking errors
also surface their error message in the command field.
This covers the full hook surface area:
- system/stop_hook_summary → Stop hooks (already fixed)
- type:attachment + hookEvent → ALL other hook events (this commit)
- system/hook_progress → verbose/stream-json mode hooks
Three new tests: hook_success attachment, hook_blocking_error with message,
non-hook attachment dropped.
https://claude.ai/code/session_01MK63kGRSmtkGSXCDaqh8p3
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments