claude_agent 0.7.12 → 0.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/rules/testing.md +51 -10
  3. data/.claude/settings.json +1 -0
  4. data/ARCHITECTURE.md +237 -0
  5. data/CHANGELOG.md +45 -0
  6. data/CLAUDE.md +2 -0
  7. data/README.md +46 -1
  8. data/Rakefile +17 -0
  9. data/SPEC.md +214 -125
  10. data/lib/claude_agent/client/commands.rb +225 -0
  11. data/lib/claude_agent/client.rb +4 -204
  12. data/lib/claude_agent/content_blocks/generic_block.rb +39 -0
  13. data/lib/claude_agent/content_blocks/image_content_block.rb +54 -0
  14. data/lib/claude_agent/content_blocks/server_tool_result_block.rb +22 -0
  15. data/lib/claude_agent/content_blocks/server_tool_use_block.rb +48 -0
  16. data/lib/claude_agent/content_blocks/text_block.rb +19 -0
  17. data/lib/claude_agent/content_blocks/thinking_block.rb +19 -0
  18. data/lib/claude_agent/content_blocks/tool_result_block.rb +25 -0
  19. data/lib/claude_agent/content_blocks/tool_use_block.rb +134 -0
  20. data/lib/claude_agent/content_blocks.rb +8 -335
  21. data/lib/claude_agent/control_protocol/commands.rb +304 -0
  22. data/lib/claude_agent/control_protocol/lifecycle.rb +113 -0
  23. data/lib/claude_agent/control_protocol/messaging.rb +166 -0
  24. data/lib/claude_agent/control_protocol/primitives.rb +168 -0
  25. data/lib/claude_agent/control_protocol/request_handling.rb +231 -0
  26. data/lib/claude_agent/control_protocol.rb +27 -882
  27. data/lib/claude_agent/event_handler.rb +1 -0
  28. data/lib/claude_agent/get_session_info.rb +86 -0
  29. data/lib/claude_agent/hooks.rb +23 -2
  30. data/lib/claude_agent/list_sessions.rb +22 -13
  31. data/lib/claude_agent/message_parser.rb +26 -4
  32. data/lib/claude_agent/messages/conversation.rb +138 -0
  33. data/lib/claude_agent/messages/generic.rb +39 -0
  34. data/lib/claude_agent/messages/hook_lifecycle.rb +158 -0
  35. data/lib/claude_agent/messages/result.rb +80 -0
  36. data/lib/claude_agent/messages/streaming.rb +84 -0
  37. data/lib/claude_agent/messages/system.rb +67 -0
  38. data/lib/claude_agent/messages/task_lifecycle.rb +240 -0
  39. data/lib/claude_agent/messages/tool_lifecycle.rb +95 -0
  40. data/lib/claude_agent/messages.rb +11 -829
  41. data/lib/claude_agent/options/serializer.rb +194 -0
  42. data/lib/claude_agent/options.rb +11 -176
  43. data/lib/claude_agent/sandbox_settings.rb +3 -0
  44. data/lib/claude_agent/session.rb +0 -204
  45. data/lib/claude_agent/session_mutations.rb +148 -0
  46. data/lib/claude_agent/types/mcp.rb +30 -0
  47. data/lib/claude_agent/types/models.rb +146 -0
  48. data/lib/claude_agent/types/operations.rb +38 -0
  49. data/lib/claude_agent/types/sessions.rb +50 -0
  50. data/lib/claude_agent/types/tools.rb +32 -0
  51. data/lib/claude_agent/types.rb +6 -264
  52. data/lib/claude_agent/v2_session.rb +207 -0
  53. data/lib/claude_agent/version.rb +1 -1
  54. data/lib/claude_agent.rb +37 -3
  55. data/sig/claude_agent.rbs +144 -13
  56. metadata +33 -1
data/SPEC.md CHANGED
@@ -3,11 +3,11 @@
3
3
  This document provides a comprehensive specification of the Claude Agent SDK, comparing feature parity across the official TypeScript and Python SDKs with this Ruby implementation.
4
4
 
5
5
  **Reference Versions:**
6
- - TypeScript SDK: v0.2.62 (npm package)
7
- - Python SDK: v0.1.44 from GitHub (commit 7297bdc)
6
+ - TypeScript SDK: v0.2.75 (npm package)
7
+ - Python SDK: from GitHub (commit 9880677)
8
8
  - Ruby SDK: This repository
9
9
 
10
- **Last Updated:** 2026-02-27
10
+ **Last Updated:** 2026-03-13
11
11
 
12
12
  ---
13
13
 
@@ -69,6 +69,7 @@ Configuration options for SDK queries and clients.
69
69
  | `env` | ✅ | ✅ | ✅ | Environment variables |
70
70
  | `sandbox` | ✅ | ✅ | ✅ | Sandbox settings |
71
71
  | `settingSources` | ✅ | ✅ | ✅ | Which settings to load |
72
+ | `settings` | ✅ | ✅ | ✅ | Additional settings (path or object) |
72
73
  | `plugins` | ✅ | ✅ | ✅ | Plugin configurations |
73
74
  | `betas` | ✅ | ✅ | ✅ | Beta features (e.g., context-1m-2025-08-07) |
74
75
  | `abortController` | ✅ | ❌ | ✅ | Cancellation controller |
@@ -81,6 +82,9 @@ Configuration options for SDK queries and clients.
81
82
  | `promptSuggestions` | ✅ | ❌ | ✅ | Enable prompt suggestion after each turn (v0.2.47) |
82
83
  | `debug` | ✅ | ❌ | ✅ | Enable verbose debug logging |
83
84
  | `debugFile` | ✅ | ❌ | ✅ | Write debug logs to specific file path |
85
+ | `toolConfig` | ✅ | ❌ | ✅ | Tool behavior config (e.g., askUserQuestion preview format) |
86
+ | `onElicitation` | ✅ | ❌ | ✅ | MCP elicitation request handler callback |
87
+ | `agentProgressSummaries` | ✅ | ❌ | ✅ | Progress summaries for subagents (v0.2.72) |
84
88
 
85
89
  ---
86
90
 
@@ -88,28 +92,30 @@ Configuration options for SDK queries and clients.
88
92
 
89
93
  Messages exchanged between SDK and CLI.
90
94
 
91
- | Message Type | TypeScript | Python | Ruby | Notes |
92
- |---------------------------|:----------:|:------:|:----:|------------------------------------|
93
- | `UserMessage` | ✅ | ✅ | ✅ | User input |
94
- | `UserMessageReplay` | ✅ | ❌ | ✅ | Replayed user message on resume |
95
- | `AssistantMessage` | ✅ | ✅ | ✅ | Claude response |
96
- | `SystemMessage` | ✅ | ✅ | ✅ | System/init messages |
97
- | `ResultMessage` | ✅ | ✅ | ✅ | Final result with usage |
98
- | `StreamEvent` | ✅ | ✅ | ✅ | Partial streaming events |
99
- | `CompactBoundaryMessage` | ✅ | ❌ | ✅ | Conversation compaction marker |
100
- | `StatusMessage` | ✅ | ❌ | ✅ | Status updates (compacting) |
101
- | `ToolProgressMessage` | ✅ | ❌ | ✅ | Long-running tool progress |
102
- | `HookStartedMessage` | ✅ | ❌ | ✅ | Hook execution started |
103
- | `HookProgressMessage` | ✅ | ❌ | ✅ | Hook progress during execution |
104
- | `HookResponseMessage` | ✅ | ❌ | ✅ | Hook execution output |
105
- | `AuthStatusMessage` | ✅ | ❌ | ✅ | Authentication status |
106
- | `TaskNotificationMessage` | ✅ | | ✅ | Background task completion |
107
- | `ToolUseSummaryMessage` | ✅ | ❌ | ✅ | Summary of tool use (collapsed) |
108
- | `TaskStartedMessage` | ✅ | | ✅ | Subagent task registered (v0.2.45) |
109
- | `TaskProgressMessage` | ✅ | | ✅ | Background task progress (v0.2.51) |
110
- | `RateLimitEvent` | ✅ | | ✅ | Rate limit status changes |
111
- | `PromptSuggestionMessage` | ✅ | ❌ | ✅ | Suggested next prompt (v0.2.47) |
112
- | `FilesPersistedEvent` | ✅ | ❌ | ✅ | File persistence confirmation |
95
+ | Message Type | TypeScript | Python | Ruby | Notes |
96
+ |------------------------------|:----------:|:------:|:----:|------------------------------------|
97
+ | `UserMessage` | ✅ | ✅ | ✅ | User input |
98
+ | `UserMessageReplay` | ✅ | ❌ | ✅ | Replayed user message on resume |
99
+ | `AssistantMessage` | ✅ | ✅ | ✅ | Claude response |
100
+ | `SystemMessage` | ✅ | ✅ | ✅ | System/init messages |
101
+ | `ResultMessage` | ✅ | ✅ | ✅ | Final result with usage |
102
+ | `StreamEvent` | ✅ | ✅ | ✅ | Partial streaming events |
103
+ | `CompactBoundaryMessage` | ✅ | ❌ | ✅ | Conversation compaction marker |
104
+ | `StatusMessage` | ✅ | ❌ | ✅ | Status updates (compacting) |
105
+ | `ToolProgressMessage` | ✅ | ❌ | ✅ | Long-running tool progress |
106
+ | `HookStartedMessage` | ✅ | ❌ | ✅ | Hook execution started |
107
+ | `HookProgressMessage` | ✅ | ❌ | ✅ | Hook progress during execution |
108
+ | `HookResponseMessage` | ✅ | ❌ | ✅ | Hook execution output |
109
+ | `AuthStatusMessage` | ✅ | ❌ | ✅ | Authentication status |
110
+ | `TaskNotificationMessage` | ✅ | | ✅ | Background task completion |
111
+ | `ToolUseSummaryMessage` | ✅ | ❌ | ✅ | Summary of tool use (collapsed) |
112
+ | `TaskStartedMessage` | ✅ | | ✅ | Subagent task registered (v0.2.45) |
113
+ | `TaskProgressMessage` | ✅ | | ✅ | Background task progress (v0.2.51) |
114
+ | `RateLimitEvent` | ✅ | | ✅ | Rate limit status changes |
115
+ | `PromptSuggestionMessage` | ✅ | ❌ | ✅ | Suggested next prompt (v0.2.47) |
116
+ | `FilesPersistedEvent` | ✅ | ❌ | ✅ | File persistence confirmation |
117
+ | `ElicitationCompleteMessage` | ✅ | ❌ | ✅ | MCP elicitation completed |
118
+ | `LocalCommandOutputMessage` | ✅ | ❌ | ✅ | Local command output |
113
119
 
114
120
  ### Message Fields
115
121
 
@@ -131,7 +137,8 @@ Messages exchanged between SDK and CLI.
131
137
  | `errors` | ✅ | ❌ | ✅ | Error messages |
132
138
  | `uuid` | ✅ | ❌ | ✅ | Message UUID |
133
139
  | `session_id` | ✅ | ✅ | ✅ | Session ID |
134
- | `stop_reason` | ✅ | | ✅ | Why model stopped |
140
+ | `stop_reason` | ✅ | | ✅ | Why model stopped |
141
+ | `fast_mode_state` | ✅ | ❌ | ✅ | Fast mode status |
135
142
 
136
143
  #### Result Subtypes
137
144
 
@@ -147,12 +154,12 @@ Messages exchanged between SDK and CLI.
147
154
 
148
155
  | Field | TypeScript | Python | Ruby | Notes |
149
156
  |---------------|:----------:|:------:|:----:|-----------------------------|
150
- | `task_id` | ✅ | | ✅ | Task identifier |
151
- | `tool_use_id` | ✅ | | ✅ | Correlating tool call ID |
152
- | `status` | ✅ | | ✅ | completed/failed/stopped |
153
- | `output_file` | ✅ | | ✅ | Path to task output |
154
- | `summary` | ✅ | | ✅ | Task summary |
155
- | `usage` | ✅ | | ✅ | Tokens/tool counts/duration |
157
+ | `task_id` | ✅ | | ✅ | Task identifier |
158
+ | `tool_use_id` | ✅ | | ✅ | Correlating tool call ID |
159
+ | `status` | ✅ | | ✅ | completed/failed/stopped |
160
+ | `output_file` | ✅ | | ✅ | Path to task output |
161
+ | `summary` | ✅ | | ✅ | Task summary |
162
+ | `usage` | ✅ | | ✅ | Tokens/tool counts/duration |
156
163
 
157
164
  #### ToolProgressMessage
158
165
 
@@ -203,20 +210,22 @@ Messages exchanged between SDK and CLI.
203
210
 
204
211
  | Field | TypeScript | Python | Ruby | Notes |
205
212
  |---------------|:----------:|:------:|:----:|-------------------------|
206
- | `task_id` | ✅ | | ✅ | Task identifier |
207
- | `tool_use_id` | ✅ | | ✅ | Correlating tool use ID |
208
- | `description` | ✅ | | ✅ | Task description |
209
- | `task_type` | ✅ | | ✅ | Task type (e.g., bash) |
213
+ | `task_id` | ✅ | | ✅ | Task identifier |
214
+ | `tool_use_id` | ✅ | | ✅ | Correlating tool use ID |
215
+ | `description` | ✅ | | ✅ | Task description |
216
+ | `task_type` | ✅ | | ✅ | Task type (e.g., bash) |
217
+ | `prompt` | ✅ | ❌ | ✅ | Task prompt (v0.2.75) |
210
218
 
211
219
  #### TaskProgressMessage
212
220
 
213
221
  | Field | TypeScript | Python | Ruby | Notes |
214
222
  |------------------|:----------:|:------:|:----:|---------------------------------------------------|
215
- | `task_id` | ✅ | | ✅ | Task identifier |
216
- | `tool_use_id` | ✅ | | ✅ | Correlating tool use ID |
217
- | `description` | ✅ | | ✅ | Current progress description |
218
- | `usage` | ✅ | | ✅ | Cumulative {total_tokens, tool_uses, duration_ms} |
219
- | `last_tool_name` | ✅ | | ✅ | Last tool executed |
223
+ | `task_id` | ✅ | | ✅ | Task identifier |
224
+ | `tool_use_id` | ✅ | | ✅ | Correlating tool use ID |
225
+ | `description` | ✅ | | ✅ | Current progress description |
226
+ | `usage` | ✅ | | ✅ | Cumulative {total_tokens, tool_uses, duration_ms} |
227
+ | `last_tool_name` | ✅ | | ✅ | Last tool executed |
228
+ | `summary` | ✅ | ❌ | ✅ | AI-generated progress summary (v0.2.72) |
220
229
 
221
230
  #### AuthStatusMessage
222
231
 
@@ -237,9 +246,9 @@ Messages exchanged between SDK and CLI.
237
246
 
238
247
  | Field | TypeScript | Python | Ruby | Notes |
239
248
  |-------------------|:----------:|:------:|:----:|---------------------------------|
240
- | `rate_limit_info` | ✅ | | ✅ | Rate limit details object |
249
+ | `rate_limit_info` | ✅ | | ✅ | Rate limit details object |
241
250
 
242
- Rate limit info contains: `status`, `resetsAt`, `rateLimitType`, `utilization`, `isUsingOverage`, `overageStatus`.
251
+ Rate limit info contains: `status`, `resetsAt`, `rateLimitType`, `utilization`, `isUsingOverage`, `overageStatus`, `overageResetsAt`, `overageDisabledReason` (v0.2.49+), `surpassedThreshold`.
243
252
 
244
253
  #### PromptSuggestionMessage
245
254
 
@@ -309,15 +318,16 @@ Bidirectional control protocol for SDK-CLI communication.
309
318
  | `mcp_message` | ✅ | ✅ | ✅ | Route MCP message |
310
319
  | `mcp_set_servers` | ✅ | ❌ | ✅ | Dynamically set MCP servers |
311
320
  | `mcp_status` | ✅ | ✅ | ✅ | Get MCP server status |
312
- | `mcp_reconnect` | ✅ | | ✅ | Reconnect to MCP server |
313
- | `mcp_toggle` | ✅ | | ✅ | Enable/disable MCP server |
314
- | `stop_task` | ✅ | | ✅ | Stop a running background task |
321
+ | `mcp_reconnect` | ✅ | | ✅ | Reconnect to MCP server |
322
+ | `mcp_toggle` | ✅ | | ✅ | Enable/disable MCP server |
323
+ | `stop_task` | ✅ | | ✅ | Stop a running background task |
315
324
  | `mcp_authenticate` | ✅ | ❌ | ✅ | Authenticate MCP server (v0.2.52) |
316
325
  | `mcp_clear_auth` | ✅ | ❌ | ✅ | Clear MCP server auth (v0.2.52) |
317
326
  | `supported_commands` | ✅ | ❌ | ✅ | Get available slash commands |
318
327
  | `supported_models` | ✅ | ❌ | ✅ | Get available models |
319
328
  | `account_info` | ✅ | ❌ | ✅ | Get account information |
320
329
  | `apply_flag_settings` | ✅ | ❌ | ✅ | Merge settings into flag layer |
330
+ | `supported_agents` | ✅ | ❌ | ✅ | Get available subagents (v0.2.63) |
321
331
 
322
332
  ### Return Types
323
333
 
@@ -330,17 +340,20 @@ Bidirectional control protocol for SDK-CLI communication.
330
340
  | `InitializationResult` | ✅ | ❌ | ✅ | Full init response |
331
341
  | `McpSetServersResult` | ✅ | ❌ | ✅ | Set servers result |
332
342
  | `RewindFilesResult` | ✅ | ✅ | ✅ | Rewind result |
343
+ | `AgentInfo` | ✅ | ❌ | ✅ | Available agent info |
333
344
 
334
345
  #### ModelInfo Fields
335
346
 
336
- | Field | TypeScript | Python | Ruby | Notes |
337
- |----------------------------|:----------:|:------:|:----:|---------------------------------|
338
- | `value` | ✅ | ❌ | ✅ | Model identifier |
339
- | `displayName` | ✅ | ❌ | ✅ | Human-readable name |
340
- | `description` | ✅ | ❌ | ✅ | Model description |
341
- | `supportsEffort` | ✅ | ❌ | ✅ | Whether model supports effort |
342
- | `supportedEffortLevels` | ✅ | ❌ | ✅ | Available effort levels |
343
- | `supportsAdaptiveThinking` | ✅ | ❌ | ✅ | Whether adaptive thinking works |
347
+ | Field | TypeScript | Python | Ruby | Notes |
348
+ |----------------------------|:----------:|:------:|:----:|--------------------------------------------|
349
+ | `value` | ✅ | ❌ | ✅ | Model identifier |
350
+ | `displayName` | ✅ | ❌ | ✅ | Human-readable name |
351
+ | `description` | ✅ | ❌ | ✅ | Model description |
352
+ | `supportsEffort` | ✅ | ❌ | ✅ | Whether model supports effort |
353
+ | `supportedEffortLevels` | ✅ | ❌ | ✅ | Available effort levels |
354
+ | `supportsAdaptiveThinking` | ✅ | ❌ | ✅ | Whether adaptive thinking works |
355
+ | `supportsFastMode` | ✅ | ❌ | ✅ | Whether model supports fast mode (v0.2.69) |
356
+ | `supportsAutoMode` | ✅ | ❌ | ✅ | Whether model supports auto mode (v0.2.75) |
344
357
 
345
358
  #### McpServerStatus Fields
346
359
 
@@ -348,11 +361,11 @@ Bidirectional control protocol for SDK-CLI communication.
348
361
  |--------------|:----------:|:------:|:----:|------------------------------------|
349
362
  | `name` | ✅ | ✅ | ✅ | Server name |
350
363
  | `status` | ✅ | ✅ | ✅ | Connection status |
351
- | `serverInfo` | ✅ | | ✅ | Server name/version |
352
- | `error` | ✅ | | ✅ | Error message (when failed) |
353
- | `config` | ✅ | | ✅ | Server configuration |
354
- | `scope` | ✅ | | ✅ | Config scope (project, user, etc.) |
355
- | `tools` | ✅ | | ✅ | Tools with annotations |
364
+ | `serverInfo` | ✅ | | ✅ | Server name/version |
365
+ | `error` | ✅ | | ✅ | Error message (when failed) |
366
+ | `config` | ✅ | | ✅ | Server configuration |
367
+ | `scope` | ✅ | | ✅ | Config scope (project, user, etc.) |
368
+ | `tools` | ✅ | | ✅ | Tools with annotations |
356
369
 
357
370
  #### InitializationResult Fields
358
371
 
@@ -363,6 +376,8 @@ Bidirectional control protocol for SDK-CLI communication.
363
376
  | `available_output_styles` | ✅ | ❌ | ✅ | All available output styles |
364
377
  | `models` | ✅ | ❌ | ✅ | Available models (ModelInfo[]) |
365
378
  | `account` | ✅ | ❌ | ✅ | Account information (AccountInfo) |
379
+ | `agents` | ✅ | ❌ | ✅ | Available agents (AgentInfo[]) |
380
+ | `fast_mode_state` | ✅ | ❌ | ✅ | Fast mode status (v0.2.75) |
366
381
 
367
382
  #### RewindFilesResult Fields
368
383
 
@@ -382,6 +397,14 @@ Bidirectional control protocol for SDK-CLI communication.
382
397
  | `removed` | ✅ | ❌ | ✅ | Server names that were removed |
383
398
  | `errors` | ✅ | ❌ | ✅ | Map of server name to error |
384
399
 
400
+ #### AgentInfo Fields
401
+
402
+ | Field | TypeScript | Python | Ruby | Notes |
403
+ |---------------|:----------:|:------:|:----:|------------------------------------|
404
+ | `name` | ✅ | ❌ | ✅ | Agent type identifier |
405
+ | `description` | ✅ | ❌ | ✅ | When to use this agent |
406
+ | `model` | ✅ | ❌ | ✅ | Model alias (inherits if omitted) |
407
+
385
408
  ---
386
409
 
387
410
  ## 5. Hooks
@@ -397,7 +420,7 @@ Event hooks for intercepting and modifying SDK behavior.
397
420
  | `PostToolUseFailure` | ✅ | ✅ | ✅ | After tool failure (Py v0.1.26) |
398
421
  | `Notification` | ✅ | ✅ | ✅ | System notifications (Py v0.1.29) |
399
422
  | `UserPromptSubmit` | ✅ | ✅ | ✅ | User message submitted |
400
- | `SessionStart` | ✅ | | ✅ | Session starts |
423
+ | `SessionStart` | ✅ | | ✅ | Session starts |
401
424
  | `SessionEnd` | ✅ | ❌ | ✅ | Session ends |
402
425
  | `Stop` | ✅ | ✅ | ✅ | Agent stops |
403
426
  | `SubagentStart` | ✅ | ✅ | ✅ | Subagent starts (Py v0.1.29) |
@@ -407,9 +430,12 @@ Event hooks for intercepting and modifying SDK behavior.
407
430
  | `Setup` | ✅ | ❌ | ✅ | Initial setup/maintenance |
408
431
  | `TeammateIdle` | ✅ | ❌ | ✅ | Teammate idle (v0.2.33) |
409
432
  | `TaskCompleted` | ✅ | ❌ | ✅ | Task completed (v0.2.33) |
433
+ | `Elicitation` | ✅ | ❌ | ✅ | MCP elicitation request |
434
+ | `ElicitationResult` | ✅ | ❌ | ✅ | MCP elicitation response |
410
435
  | `ConfigChange` | ✅ | ❌ | ✅ | Config file changed (v0.2.49) |
411
436
  | `WorktreeCreate` | ✅ | ❌ | ✅ | Worktree creation (v0.2.50) |
412
437
  | `WorktreeRemove` | ✅ | ❌ | ✅ | Worktree removal (v0.2.50) |
438
+ | `InstructionsLoaded` | ✅ | ❌ | ✅ | CLAUDE.md file loaded (v0.2.69) |
413
439
 
414
440
  ### Hook Input Types
415
441
 
@@ -430,9 +456,23 @@ Event hooks for intercepting and modifying SDK behavior.
430
456
  | `SetupHookInput` | ✅ | ❌ | ✅ |
431
457
  | `TeammateIdleHookInput` | ✅ | ❌ | ✅ |
432
458
  | `TaskCompletedHookInput` | ✅ | ❌ | ✅ |
459
+ | `ElicitationHookInput` | ✅ | ❌ | ✅ |
460
+ | `ElicitationResultHookInput` | ✅ | ❌ | ✅ |
433
461
  | `ConfigChangeHookInput` | ✅ | ❌ | ✅ |
434
462
  | `WorktreeCreateHookInput` | ✅ | ❌ | ✅ |
435
463
  | `WorktreeRemoveHookInput` | ✅ | ❌ | ✅ |
464
+ | `InstructionsLoadedHookInput` | ✅ | ❌ | ✅ |
465
+
466
+ #### BaseHookInput Fields
467
+
468
+ | Field | TypeScript | Python | Ruby | Notes |
469
+ |-------------------|:----------:|:------:|:----:|--------------------------------------------------|
470
+ | `session_id` | ✅ | ✅ | ✅ | Session identifier |
471
+ | `transcript_path` | ✅ | ✅ | ✅ | Path to session transcript |
472
+ | `cwd` | ✅ | ✅ | ✅ | Working directory |
473
+ | `permission_mode` | ✅ | ❌ | ✅ | Current permission mode |
474
+ | `agent_id` | ✅ | ✅ | ✅ | Subagent ID (when in subagent context) (v0.2.69) |
475
+ | `agent_type` | ✅ | ✅ | ✅ | Agent type name (v0.2.69) |
436
476
 
437
477
  #### StopHookInput Fields
438
478
 
@@ -527,6 +567,20 @@ Event-specific fields returned via `hookSpecificOutput`:
527
567
  |---------------------|:----------:|:------:|:----:|----------------------------------|
528
568
  | `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
529
569
 
570
+ #### ElicitationHookSpecificOutput
571
+
572
+ | Field | TypeScript | Python | Ruby | Notes |
573
+ |-----------|:----------:|:------:|:----:|----------------------------------|
574
+ | `action` | ✅ | ❌ | ✅ | accept/decline/cancel |
575
+ | `content` | ✅ | ❌ | ✅ | Response content for form mode |
576
+
577
+ #### ElicitationResultHookSpecificOutput
578
+
579
+ | Field | TypeScript | Python | Ruby | Notes |
580
+ |-----------|:----------:|:------:|:----:|----------------------------------|
581
+ | `action` | ✅ | ❌ | ✅ | accept/decline/cancel |
582
+ | `content` | ✅ | ❌ | ✅ | Response content |
583
+
530
584
  ### Hook Matcher
531
585
 
532
586
  | Field | TypeScript | Python | Ruby |
@@ -592,15 +646,15 @@ Permission handling and updates.
592
646
 
593
647
  ### ToolPermissionContext
594
648
 
595
- | Field | TypeScript | Python | Ruby | Notes |
596
- |------------------|:----------:|:------:|:----:|---------------------------------|
597
- | `signal` | ✅ | ✅ | ✅ | Abort signal |
598
- | `suggestions` | ✅ | ✅ | ✅ | Permission suggestions |
599
- | `blockedPath` | ✅ | ❌ | ✅ | Blocked file path |
600
- | `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered |
601
- | `toolUseID` | ✅ | ❌ | ✅ | Tool call ID |
602
- | `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable |
603
- | `description` | ✅ | ❌ | ✅ | Human-readable tool description |
649
+ | Field | TypeScript | Python | Ruby | Notes |
650
+ |------------------|:----------:|:------:|:----:|--------------------------------------------------|
651
+ | `signal` | ✅ | ✅ | ✅ | Abort signal |
652
+ | `suggestions` | ✅ | ✅ | ✅ | Permission suggestions |
653
+ | `blockedPath` | ✅ | ❌ | ✅ | Blocked file path |
654
+ | `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered |
655
+ | `toolUseID` | ✅ | ❌ | ✅ | Tool call ID |
656
+ | `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable |
657
+ | `description` | ✅ | ❌ | ✅ | Human-readable tool description (v0.2.75) |
604
658
 
605
659
  ---
606
660
 
@@ -681,46 +735,53 @@ Session management and resumption.
681
735
 
682
736
  | Feature | TypeScript | Python | Ruby | Notes |
683
737
  |------------------------|:----------:|:------:|:----:|--------------------------------------------------|
684
- | `listSessions()` | ✅ | | ✅ | List past sessions with metadata (v0.2.53) |
685
- | `getSessionMessages()` | ✅ | | ✅ | Read session transcript messages (v0.2.59) |
738
+ | `listSessions()` | ✅ | | ✅ | List past sessions with metadata (v0.2.53) |
739
+ | `getSessionMessages()` | ✅ | | ✅ | Read session transcript messages (v0.2.59) |
740
+ | `getSessionInfo()` | ✅ | ❌ | ✅ | Get single session metadata (v0.2.75) |
741
+ | `renameSession()` | ✅ | ✅ | ✅ | Rename a session (v0.2.74) |
742
+ | `tagSession()` | ✅ | ✅ | ✅ | Tag a session (v0.2.75) |
686
743
 
687
744
  #### ListSessionsOptions
688
745
 
689
- | Field | TypeScript | Python | Ruby | Notes |
690
- |---------|:----------:|:------:|:----:|-------------------------------------------|
691
- | `dir` | ✅ | | ✅ | Project directory (includes worktrees) |
692
- | `limit` | ✅ | | ✅ | Maximum number of sessions to return |
746
+ | Field | TypeScript | Python | Ruby | Notes |
747
+ |--------------------|:----------:|:------:|:----:|-----------------------------------------------|
748
+ | `dir` | ✅ | | ✅ | Project directory (includes worktrees) |
749
+ | `limit` | ✅ | | ✅ | Maximum number of sessions to return |
750
+ | `includeWorktrees` | ✅ | ✅ | ✅ | Include git worktree sessions (default: true) |
751
+ | `offset` | ✅ | ❌ | ✅ | Pagination offset (v0.2.75) |
693
752
 
694
753
  #### GetSessionMessagesOptions
695
754
 
696
755
  | Field | TypeScript | Python | Ruby | Notes |
697
756
  |----------|:----------:|:------:|:----:|----------------------------------------------|
698
- | `dir` | ✅ | | ✅ | Project directory to find session in |
699
- | `limit` | ✅ | | ✅ | Maximum number of messages to return |
700
- | `offset` | ✅ | | ✅ | Number of messages to skip from the start |
757
+ | `dir` | ✅ | | ✅ | Project directory to find session in |
758
+ | `limit` | ✅ | | ✅ | Maximum number of messages to return |
759
+ | `offset` | ✅ | | ✅ | Number of messages to skip from the start |
701
760
 
702
761
  #### SessionMessage Fields
703
762
 
704
763
  | Field | TypeScript | Python | Ruby | Notes |
705
764
  |----------------------|:----------:|:------:|:----:|----------------------------------|
706
- | `type` | ✅ | | ✅ | 'user' or 'assistant' |
707
- | `uuid` | ✅ | | ✅ | Message UUID |
708
- | `session_id` | ✅ | | ✅ | Session ID |
709
- | `message` | ✅ | | ✅ | Raw message content |
710
- | `parent_tool_use_id` | ✅ | | ✅ | Parent tool use ID (always null) |
765
+ | `type` | ✅ | | ✅ | 'user' or 'assistant' |
766
+ | `uuid` | ✅ | | ✅ | Message UUID |
767
+ | `session_id` | ✅ | | ✅ | Session ID |
768
+ | `message` | ✅ | | ✅ | Raw message content |
769
+ | `parent_tool_use_id` | ✅ | | ✅ | Parent tool use ID (always null) |
711
770
 
712
771
  #### SDKSessionInfo Fields
713
772
 
714
773
  | Field | TypeScript | Python | Ruby | Notes |
715
774
  |----------------|:----------:|:------:|:----:|-------------------------------------|
716
- | `sessionId` | ✅ | | ✅ | Session UUID |
717
- | `summary` | ✅ | | ✅ | Display title/summary |
718
- | `lastModified` | ✅ | | ✅ | Last modified time (ms since epoch) |
719
- | `fileSize` | ✅ | | ✅ | Session file size in bytes |
720
- | `customTitle` | ✅ | | ✅ | User-set title via /rename |
721
- | `firstPrompt` | ✅ | | ✅ | First meaningful user prompt |
722
- | `gitBranch` | ✅ | | ✅ | Git branch at end of session |
723
- | `cwd` | ✅ | | ✅ | Working directory for session |
775
+ | `sessionId` | ✅ | | ✅ | Session UUID |
776
+ | `summary` | ✅ | | ✅ | Display title/summary |
777
+ | `lastModified` | ✅ | | ✅ | Last modified time (ms since epoch) |
778
+ | `fileSize` | ✅ | | ✅ | Session file size in bytes |
779
+ | `customTitle` | ✅ | | ✅ | User-set title via /rename |
780
+ | `firstPrompt` | ✅ | | ✅ | First meaningful user prompt |
781
+ | `gitBranch` | ✅ | | ✅ | Git branch at end of session |
782
+ | `cwd` | ✅ | | ✅ | Working directory for session |
783
+ | `tag` | ✅ | ❌ | ✅ | User-set tag (v0.2.75) |
784
+ | `createdAt` | ✅ | ❌ | ✅ | Creation time in ms (v0.2.75) |
724
785
 
725
786
  ### V2 Session API (Unstable)
726
787
 
@@ -759,17 +820,18 @@ Sandbox configuration for command execution isolation.
759
820
 
760
821
  ### SandboxSettings
761
822
 
762
- | Field | TypeScript | Python | Ruby |
763
- |-----------------------------|:----------:|:------:|:----:|
764
- | `enabled` | ✅ | ✅ | ✅ |
765
- | `autoAllowBashIfSandboxed` | ✅ | ✅ | ✅ |
766
- | `excludedCommands` | ✅ | ✅ | ✅ |
767
- | `allowUnsandboxedCommands` | ✅ | ✅ | ✅ |
768
- | `network` | ✅ | ✅ | ✅ |
769
- | `ignoreViolations` | ✅ | ✅ | ✅ |
770
- | `enableWeakerNestedSandbox` | ✅ | ✅ | ✅ |
771
- | `ripgrep` | ✅ | ❌ | ✅ |
772
- | `filesystem` | ✅ | ❌ | ✅ |
823
+ | Field | TypeScript | Python | Ruby |
824
+ |----------------------------------|:----------:|:------:|:----:|
825
+ | `enabled` | ✅ | ✅ | ✅ |
826
+ | `autoAllowBashIfSandboxed` | ✅ | ✅ | ✅ |
827
+ | `excludedCommands` | ✅ | ✅ | ✅ |
828
+ | `allowUnsandboxedCommands` | ✅ | ✅ | ✅ |
829
+ | `network` | ✅ | ✅ | ✅ |
830
+ | `ignoreViolations` | ✅ | ✅ | ✅ |
831
+ | `enableWeakerNestedSandbox` | ✅ | ✅ | ✅ |
832
+ | `enableWeakerNetworkIsolation` | ✅ | ❌ | ✅ |
833
+ | `ripgrep` | ✅ | ❌ | ✅ |
834
+ | `filesystem` | ✅ | ❌ | ✅ |
773
835
 
774
836
  ### SandboxFilesystemConfig
775
837
 
@@ -832,8 +894,11 @@ Public API surface for SDK clients.
832
894
 
833
895
  | Feature | TypeScript | Python | Ruby | Notes |
834
896
  |------------------------|:----------:|:------:|:----:|--------------------------------------------|
835
- | `listSessions()` | ✅ | | ✅ | List past sessions with metadata (v0.2.53) |
836
- | `getSessionMessages()` | ✅ | | ✅ | Read session transcript (v0.2.59) |
897
+ | `listSessions()` | ✅ | | ✅ | List past sessions with metadata (v0.2.53) |
898
+ | `getSessionMessages()` | ✅ | | ✅ | Read session transcript (v0.2.59) |
899
+ | `getSessionInfo()` | ✅ | ❌ | ✅ | Get single session metadata (v0.2.75) |
900
+ | `renameSession()` | ✅ | ✅ | ✅ | Rename a session (v0.2.74) |
901
+ | `tagSession()` | ✅ | ✅ | ✅ | Tag a session (v0.2.75) |
837
902
 
838
903
  ### Query Interface
839
904
 
@@ -856,25 +921,26 @@ Public API surface for SDK clients.
856
921
  | `accountInfo()` | ✅ | ❌ | ✅ | Get account info |
857
922
  | `rewindFiles()` | ✅ | ✅ | ✅ | Rewind file changes |
858
923
  | `setMcpServers()` | ✅ | ❌ | ✅ | Dynamic MCP servers |
859
- | `reconnectMcpServer()` | ✅ | | ✅ | Reconnect MCP server |
860
- | `toggleMcpServer()` | ✅ | | ✅ | Enable/disable MCP |
861
- | `stopTask()` | ✅ | | ✅ | Stop running task |
924
+ | `reconnectMcpServer()` | ✅ | | ✅ | Reconnect MCP server |
925
+ | `toggleMcpServer()` | ✅ | | ✅ | Enable/disable MCP |
926
+ | `stopTask()` | ✅ | | ✅ | Stop running task |
862
927
  | `streamInput()` | ✅ | ✅ | ✅ | Stream user input |
863
928
  | `initializationResult()` | ✅ | ✅ | ✅ | Full init response (Py: `get_server_info()`) |
864
929
  | `close()` | ✅ | ✅ | ✅ | Close query/session |
930
+ | `supportedAgents()` | ✅ | ❌ | ✅ | Get available subagents (v0.2.63) |
865
931
 
866
932
  ### Client Class
867
933
 
868
- | Feature | TypeScript | Python | Ruby | Notes |
869
- |----------------------|:----------:|:-------------------:|:-----------------------:|-------------------------------------------------------------------------------------|
870
- | Multi-turn client | ❌ | ✅ `ClaudeSDKClient` | ✅ `ClaudeAgent::Client` | Interactive sessions |
871
- | `connect()` | N/A | ✅ | ✅ | Start session |
872
- | `disconnect()` | N/A | ✅ | ✅ | End session |
873
- | `send_message()` | N/A | ✅ | ✅ | Send user message |
874
- | `receive_response()` | N/A | ✅ | ✅ | Receive until result |
875
- | `stream_input()` | N/A | ❌ | ✅ | Stream input messages |
876
- | `abort!()` | N/A | ❌ | ✅ | Abort operations |
877
- | Control methods | N/A | Partial | ✅ | interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus (Python); all (Ruby) |
934
+ | Feature | TypeScript | Python | Ruby | Notes |
935
+ |----------------------|:----------:|:-------------------:|:-----------------------:|----------------------------------------------------------------------------------------------------------------------|
936
+ | Multi-turn client | ❌ | ✅ `ClaudeSDKClient` | ✅ `ClaudeAgent::Client` | Interactive sessions |
937
+ | `connect()` | N/A | ✅ | ✅ | Start session |
938
+ | `disconnect()` | N/A | ✅ | ✅ | End session |
939
+ | `send_message()` | N/A | ✅ | ✅ | Send user message |
940
+ | `receive_response()` | N/A | ✅ | ✅ | Receive until result |
941
+ | `stream_input()` | N/A | ❌ | ✅ | Stream input messages |
942
+ | `abort!()` | N/A | ❌ | ✅ | Abort operations |
943
+ | Control methods | N/A | Partial | ✅ | Python: interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus, reconnectMcp, toggleMcp, stopTask; Ruby: all |
878
944
 
879
945
  ### Transport
880
946
 
@@ -902,7 +968,7 @@ Public API surface for SDK clients.
902
968
  - Source is bundled/minified, but `sdk.d.ts` provides complete type definitions
903
969
  - Includes unstable V2 session API
904
970
  - `executable`/`executableArgs` are JS-specific (`node`/`bun`/`deno`)
905
- - Does NOT have `settings`, `user`, `init`/`initOnly`/`maintenance` as typed Options (use `extraArgs` or `settingSources`)
971
+ - Does NOT have `user`, `init`/`initOnly`/`maintenance` as typed Options (use `extraArgs` or `settingSources`)
906
972
  - `ApiKeySource` includes `'oauth'`
907
973
  - v0.2.45: Added `TaskStartedMessage`, `RateLimitEvent` message types
908
974
  - v0.2.47: Added `promptSuggestions` option and `PromptSuggestionMessage`
@@ -914,26 +980,49 @@ Public API surface for SDK clients.
914
980
  - v0.2.54 – v0.2.58: CLI parity updates (no new SDK-facing features)
915
981
  - v0.2.59: Added `getSessionMessages()` for reading session transcript history with pagination (limit/offset)
916
982
  - v0.2.61 – v0.2.62: CLI parity updates (no new SDK-facing features)
983
+ - v0.2.63: Added `supportedAgents()` method on Query, fixed `pathToClaudeCodeExecutable` PATH resolution
984
+ - v0.2.64 – v0.2.68: CLI parity updates (no new SDK-facing features)
985
+ - v0.2.69: Added `toolConfig` option (askUserQuestion preview format), `supportsFastMode` in ModelInfo, `agent_id`/`agent_type` on BaseHookInput, `InstructionsLoaded` hook event
986
+ - v0.2.70: Made `AgentToolInput.subagent_type` optional (defaults to general-purpose), fixed HTTP MCP servers
987
+ - v0.2.71: CLI parity update; `settings` now a typed Option (string path or `Settings` object)
988
+ - v0.2.72: Added `agentProgressSummaries` option for periodic AI-generated progress summaries
989
+ - v0.2.73: Fixed `options.env` being overridden by `~/.claude/settings.json`
990
+ - v0.2.74: Added `renameSession()` for renaming session files
991
+ - v0.2.75: Added `tag`/`createdAt` fields on `SDKSessionInfo`; `getSessionInfo()` for single-session lookup; `offset` on `listSessions` for pagination; `tagSession()` for tagging sessions; `supportsAutoMode` in `ModelInfo`; `description` on `SDKControlPermissionRequest`; `prompt` on `SDKTaskStartedMessage`; `fast_mode_state` on `SDKControlInitializeResponse`; `queued_to_running` status on `AgentToolOutput`
992
+ - Includes `Elicitation`/`ElicitationResult` hook events, `onElicitation` option, `ElicitationCompleteMessage`, `LocalCommandOutputMessage`, `FastModeState` (undocumented in changelog, present in types)
917
993
 
918
994
  ### Python SDK
919
995
  - Full source available with `Transport` abstract class
920
- - Partial control protocol: query and client support interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus
996
+ - Partial control protocol: query and client support interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus, reconnectMcpServer, toggleMcpServer, stopTask
921
997
  - Has `CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `CLIJSONDecodeError`, `MessageParseError` error types
922
- - Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted, ConfigChange, WorktreeCreate, WorktreeRemove
998
+ - Has `TaskStartedMessage`, `TaskProgressMessage`, `TaskNotificationMessage` typed message classes (v0.1.46+)
999
+ - Has `stop_reason` field on ResultMessage (v0.1.46+)
1000
+ - Has `SDKSessionInfo`, `SessionMessage` types with `list_sessions()`/`get_session_messages()` functions (v0.1.46+)
1001
+ - Has `McpServerStatus` with all fields (name, status, serverInfo, error, config, scope, tools) (v0.1.46+)
1002
+ - Has `agent_id`/`agent_type` on tool-lifecycle hook inputs (v0.1.46+)
1003
+ - Has `add_mcp_server()`/`remove_mcp_server()` client methods for runtime MCP management (v0.1.46+)
1004
+ - Has `include_worktrees` parameter on `list_sessions()` (v0.1.46+)
1005
+ - Missing hooks: SessionEnd, Setup, TeammateIdle, TaskCompleted, Elicitation, ElicitationResult, ConfigChange, WorktreeCreate, WorktreeRemove, InstructionsLoaded
923
1006
  - Missing permission modes: `dontAsk`
924
- - Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`, `promptSuggestions`
1007
+ - Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`, `promptSuggestions`, `onElicitation`, `toolConfig`, `agentProgressSummaries`, `agent` (main thread agent)
925
1008
  - `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`, `description`
926
- - Has `agent_type` field in `SubagentStopHookInput`
1009
+ - Has `rename_session()`/`tag_session()` for session mutation
1010
+ - Has `RateLimitEvent`/`RateLimitInfo` types with full field coverage
927
1011
  - Has SDK MCP server support with `tool()` helper and annotations
1012
+ - Missing `getSessionInfo()`, `offset` on `list_sessions`, `tag`/`createdAt` on `SDKSessionInfo`
928
1013
  - Added `thinking` config and `effort` option in v0.1.36
929
1014
  - Handles `rate_limit_event` and unknown message types gracefully (v0.1.40)
930
1015
  - Client has `get_server_info()` for accessing the initialization result (v0.1.31+)
931
- - v0.1.42 – v0.1.44: CLI parity updates (no new SDK-facing features; latest commit bumps bundled CLI to v2.1.61)
1016
+ - v0.1.45 – v0.1.48: Major catch-up with TypeScript SDK (task messages, session APIs, MCP control methods, stop_reason)
1017
+ - v0.1.48: Fixed fine-grained tool streaming regression
1018
+ - Added `RateLimitEvent` message type with `RateLimitInfo`
1019
+ - Added `rename_session()` and `tag_session()` session management functions
1020
+ - Missing: `onElicitation`, `Elicitation`/`ElicitationResult` hooks, `ElicitationCompleteMessage`, `LocalCommandOutputMessage`, `FastModeState`, `InstructionsLoaded` hook, `agentProgressSummaries`, `getSessionInfo()`
932
1021
 
933
1022
  ### Ruby SDK (This Repository)
934
- - Feature parity with TypeScript SDK v0.2.62
1023
+ - Feature parity with TypeScript SDK v0.2.75
935
1024
  - Ruby-idiomatic patterns (Data.define, snake_case)
936
1025
  - Complete control protocol, hook, and V2 Session API support
937
1026
  - Dedicated Client class for multi-turn conversations
938
1027
  - `executable`/`executableArgs` marked N/A (JS runtime options)
939
- - Has `settings`, `init`/`initOnly`/`maintenance`, `user` options (not typed in TS SDK)
1028
+ - Full v0.2.75 parity: `agentProgressSummaries`, `getSessionInfo()`, `renameSession()`, `tagSession()`, `offset` on `listSessions`, `tag`/`createdAt` on `SessionInfo`, `supportsAutoMode` on `ModelInfo`