Repository navigation
v0.16.6
Added
- Type classes now accept hash construction with mixed key shapes — symbols or strings, snake_case or camelCase — and support bracket access (
obj[:field],obj['field']).UserMessage.new({"sessionId" => "abc"})works the same asUserMessage.new(session_id: "abc").Type.from_hash(nil)andType.wrap(nil)are nil-safe. ClaudeAgentOptions.new(nil)is accepted and yields an options object populated with configured defaults.
Changed
- Discriminator fields on type classes (
typeonSystemPromptFile/McpStdioServerConfig/etc.,behavioronPermissionResultAllow/Deny,hook_event_nameon every hook input/output) are nowattr_reader-only, set authoritatively ininitialize. They cannot be overwritten externally. ClaudeAgentOptionscontinues to raiseArgumentErroron unknown keys (constructor,dup_with, and[]=); other type subclasses silently drop unknown keys for forward-compatibility with newer CLI output.
Internal
- Unified ~50 type classes (messages, hook inputs/outputs, MCP configs, system prompt configs, sandbox settings) under a shared
Typebase class.lib/claude_agent_sdk/types.rbshrank from 1510 to 588 lines;MessageParser's system-message dispatch went from 215 lines to a 14-entry lookup table.
What's changed
Full Changelog: v0.16.5...v0.16.6
gem install claude-agent-sdk -v 0.16.6