fix(hooks): include required hookEventName in hookSpecificOutput JSON

outputWithContext() emitted a hookSpecificOutput object without the
required hookEventName field, so Claude Code rejected the hook output
("hookSpecificOutput is missing required field hookEventName") and
dropped the context the SessionStart, UserPromptSubmit, and PostToolUse
hooks tried to inject. Thread the event name through the helper; each
caller now passes its own (SessionStart / UserPromptSubmit / PostToolUse).
Existing emission tests now assert hookEventName per event.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmHCQjJHUyWwxGAVVjNLgp
This commit is contained in:
Kjell Tore Guttormsen 2026-06-24 06:46:11 +02:00
commit 7d53a7325e
8 changed files with 22 additions and 6 deletions

View file

@ -93,4 +93,4 @@ if (recent.length >= TIER2_SESSION_THRESHOLD) {
}
}
outputWithContext(msg);
outputWithContext(msg, 'SessionStart');