stdoutAsContext reports whether plain stdout (non-JSON, exit 0) from a hook should be routed into Result.AdditionalContext. It is the runtime's emit site that decides whether AdditionalContext is surfaced; events that don't consume it MUST drop plain stdout so hook authors don't think their output m
(event EventType)
| 408 | // hook authors don't think their output mattered when it would have |
| 409 | // been thrown away. |
| 410 | func stdoutAsContext(event EventType) bool { |
| 411 | switch event { |
| 412 | case EventPostToolUse, |
| 413 | EventSessionStart, |
| 414 | EventUserPromptSubmit, |
| 415 | EventUserSteeringMessagesSubmit, |
| 416 | EventUserFollowupSubmit, |
| 417 | EventTurnStart, |
| 418 | EventPreCompact, |
| 419 | EventStop, |
| 420 | EventWorktreeCreate: |
| 421 | return true |
| 422 | } |
| 423 | return false |
| 424 | } |
| 425 | |
| 426 | // aggregate combines per-hook results into a single [Result]. |
| 427 | func aggregate(results []hookResult, event EventType) *Result { |