HookEvent names 10 of the CLI's hook events; SessionStartHookSpecificOutput is exported for an event the literal cannot register
Summary
HookEvent is a Literal of ten event names (types.py:284-295). The TypeScript HookEvent union has 33, and its per-event input types cover events such as SessionStart, SessionEnd, ConfigChange, CwdChanged, FileChanged, PostCompact, PreModelSwitch, Setup, WorktreeCreate. Registration is not actually restricted: _hooks_to_internal_format iterates whatever keys are given (types.py:1943-1958) and the initialize request carries them, so a hook on SessionStart works at runtime and fails type checking. SessionStartHookSpecificOutput is exported (types.py:479-483) for an event the literal does not name.
Checked at v0.2.159 (bundled CLI 2.1.281); paths are under src/claude_agent_sdk/. TypeScript references are to @anthropic-ai/claude-agent-sdk 0.3.280, sdk.d.ts.
Repro
from claude_agent_sdk import ClaudeAgentOptions, HookMatcher
async def h(inp, tid, ctx): return {}
opts = ClaudeAgentOptions(hooks={"SessionStart": [HookMatcher(hooks=[h])]}) # mypy: invalid key; runtime: acceptedObserved with a recording transport: the initialize request's hooks object has keys PreToolUse and SessionStart, so the registration reaches the CLI.
Expected
The literal extended to the events the CLI fires (or a documented statement that any string is accepted), and the SessionStart output type either registrable or not exported.
Source: anthropics/claude-agent-sdk-python