claude_agent 0.7.1 → 0.7.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db922e35ad5e88546f17fe9d51a42d05ea0dbe5ae5b13f0f9733857b5bc467b2
4
- data.tar.gz: 55b2aceec109d36a624fb0c2fa1979b440f05758e01b894f962b5c27c02bfdb9
3
+ metadata.gz: a975c8190094b78c316e158db7bc1ba0a6bcde1d64ff1e92ada4787e13a9c756
4
+ data.tar.gz: 7ee6a218923b9734f524f95b372711d6f2b31bcb941b9364b381f210104b2726
5
5
  SHA512:
6
- metadata.gz: 1163853d431c1203309bb1926204034c9a77ab581deb52f3400cb266751a18a308be66342e8a31f7d2eae1a30767f68fb0255df35844097d733e34397345e56a
7
- data.tar.gz: 8c99d3eb98b28a31abfd704e800fc8df816132037d8c30329a2f575a88b2debe02afd3dde48842edfcd78235268484e638119209712e9a82dccde725b0f908a4
6
+ metadata.gz: 0f75560464b82fa334a168c8dc46241608a3effd288e4537dc44fbb5182df6c1006e87c60dca19a3473813816c6709c868f842c934acb3fc29dd3852ec29fd71
7
+ data.tar.gz: 9b004ea2c7c510efe51801bf9d6170a21896a4d3593ea9566f9683c40e9edf60a76eaf81d1426970cfe1313df7f3176486529b7caaa5c29ccaf96fed86456df3
data/CHANGELOG.md CHANGED
@@ -7,8 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.2] - 2026-02-05
11
+
12
+ ### Added
13
+ - `description` field on `ToolPermissionContext` (TypeScript SDK v0.2.32 parity)
14
+ - `allow_managed_domains_only` field on `SandboxNetworkConfig`
15
+ - `initialization_result` method on `ControlProtocol` and `Client` with `InitializationResult`, `SlashCommand`, `ModelInfo`, and `AccountInfo` types
16
+
17
+ ### Changed
18
+ - Updated SPEC.md to reference TypeScript SDK v0.2.32 and Python SDK v0.1.30
19
+
10
20
  ## [0.7.1] - 2026-02-03
11
21
 
22
+ ### Added
23
+ - `debug` option for verbose debug logging (`--debug` CLI flag)
24
+ - `debug_file` option for writing debug logs to a file (`--debug-file` CLI flag)
25
+ - `stop_reason` field on `ResultMessage` indicating why the model stopped generating
26
+
27
+ ### Changed
28
+ - Updated SPEC.md to reference TypeScript SDK v0.2.31 and Python SDK v0.1.29
29
+
12
30
  ## [0.7.0] - 2026-01-31
13
31
 
14
32
  ### Added
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.31 (npm package)
7
- - Python SDK: v0.1.29 from GitHub (commit 7519c96)
6
+ - TypeScript SDK: v0.2.32 (npm package)
7
+ - Python SDK: v0.1.30 from GitHub (commit 451f2f4)
8
8
  - Ruby SDK: This repository
9
9
 
10
- **Last Updated:** 2026-02-03
10
+ **Last Updated:** 2026-02-05
11
11
 
12
12
  ---
13
13
 
@@ -236,6 +236,7 @@ Bidirectional control protocol for SDK-CLI communication.
236
236
  | `ModelInfo` | ✅ | ❌ | ✅ | Model information |
237
237
  | `McpServerStatus` | ✅ | ❌ | ✅ | MCP server status |
238
238
  | `AccountInfo` | ✅ | ❌ | ✅ | Account information |
239
+ | `InitializationResult`| ✅ | ❌ | ✅ | Full init response |
239
240
  | `McpSetServersResult` | ✅ | ❌ | ✅ | Set servers result |
240
241
  | `RewindFilesResult` | ✅ | ✅ | ✅ | Rewind result |
241
242
 
@@ -306,14 +307,14 @@ Event-specific fields returned via `hookSpecificOutput`:
306
307
  | `permissionDecision` | ✅ | ✅ | ✅ | `allow`, `deny`, or `ask` |
307
308
  | `permissionDecisionReason` | ✅ | ✅ | ✅ | Reason for permission decision |
308
309
  | `updatedInput` | ✅ | ✅ | ✅ | Modified tool input |
309
- | `additionalContext` | ✅ | | ✅ | Context string returned to model |
310
+ | `additionalContext` | ✅ | | ✅ | Context string returned to model |
310
311
 
311
312
  #### PostToolUseHookSpecificOutput
312
313
 
313
314
  | Field | TypeScript | Python | Ruby | Notes |
314
315
  |------------------------|:----------:|:------:|:----:|----------------------------------|
315
316
  | `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
316
- | `updatedMCPToolOutput` | ✅ | | ✅ | Modified MCP tool output |
317
+ | `updatedMCPToolOutput` | ✅ | | ✅ | Modified MCP tool output |
317
318
 
318
319
  #### PostToolUseFailureHookSpecificOutput
319
320
 
@@ -325,7 +326,7 @@ Event-specific fields returned via `hookSpecificOutput`:
325
326
 
326
327
  | Field | TypeScript | Python | Ruby | Notes |
327
328
  |---------------------|:----------:|:------:|:----:|----------------------------------|
328
- | `additionalContext` | ✅ | | ✅ | Context string returned to model |
329
+ | `additionalContext` | ✅ | | ✅ | Context string returned to model |
329
330
 
330
331
  #### SetupHookSpecificOutput
331
332
 
@@ -337,7 +338,7 @@ Event-specific fields returned via `hookSpecificOutput`:
337
338
 
338
339
  | Field | TypeScript | Python | Ruby | Notes |
339
340
  |---------------------|:----------:|:------:|:----:|----------------------------------|
340
- | `additionalContext` | ✅ | | ✅ | Context string returned to model |
341
+ | `additionalContext` | ✅ | | ✅ | Context string returned to model |
341
342
 
342
343
  #### UserPromptSubmitHookSpecificOutput
343
344
 
@@ -349,13 +350,13 @@ Event-specific fields returned via `hookSpecificOutput`:
349
350
 
350
351
  | Field | TypeScript | Python | Ruby | Notes |
351
352
  |------------|:----------:|:------:|:----:|------------------------------------------|
352
- | `decision` | ✅ | | ✅ | `{ behavior: 'allow'/'deny', ... }` obj |
353
+ | `decision` | ✅ | | ✅ | `{ behavior: 'allow'/'deny', ... }` obj |
353
354
 
354
355
  #### NotificationHookSpecificOutput
355
356
 
356
357
  | Field | TypeScript | Python | Ruby | Notes |
357
358
  |---------------------|:----------:|:------:|:----:|----------------------------------|
358
- | `additionalContext` | ✅ | | ✅ | Context string returned to model |
359
+ | `additionalContext` | ✅ | | ✅ | Context string returned to model |
359
360
 
360
361
  ### Hook Matcher
361
362
 
@@ -423,14 +424,15 @@ Permission handling and updates.
423
424
 
424
425
  ### ToolPermissionContext
425
426
 
426
- | Field | TypeScript | Python | Ruby | Notes |
427
- |------------------|:----------:|:------:|:----:|---------------------------|
428
- | `signal` | ✅ | ✅ | ✅ | Abort signal |
429
- | `suggestions` | ✅ | ✅ | ✅ | Permission suggestions |
430
- | `blockedPath` | ✅ | ❌ | ✅ | Blocked file path |
431
- | `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered |
432
- | `toolUseID` | ✅ | ❌ | ✅ | Tool call ID |
433
- | `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable |
427
+ | Field | TypeScript | Python | Ruby | Notes |
428
+ |------------------|:----------:|:------:|:----:|---------------------------------|
429
+ | `signal` | ✅ | ✅ | ✅ | Abort signal |
430
+ | `suggestions` | ✅ | ✅ | ✅ | Permission suggestions |
431
+ | `blockedPath` | ✅ | ❌ | ✅ | Blocked file path |
432
+ | `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered |
433
+ | `toolUseID` | ✅ | ❌ | ✅ | Tool call ID |
434
+ | `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable |
435
+ | `description` | ✅ | ❌ | ✅ | Human-readable tool description |
434
436
 
435
437
  ---
436
438
 
@@ -479,10 +481,10 @@ Model Context Protocol server support.
479
481
 
480
482
  | Feature | TypeScript | Python | Ruby | Notes |
481
483
  |----------------------|:----------:|:------:|:--------------------:|--------------------------|
482
- | `createSdkMcpServer` | ✅ | | ✅ | Create SDK server |
483
- | `tool()` helper | ✅ | | ✅ | Create tool definition |
484
- | Tool input schema | ✅ (Zod) | | ✅ (Hash/JSON Schema) | Schema definition |
485
- | Tool annotations | ✅ | | ✅ | MCP tool hints (v0.2.27) |
484
+ | `createSdkMcpServer` | ✅ | | ✅ | Create SDK server |
485
+ | `tool()` helper | ✅ | | ✅ | Create tool definition |
486
+ | Tool input schema | ✅ (Zod) | | ✅ (Hash/JSON Schema) | Schema definition |
487
+ | Tool annotations | ✅ | | ✅ | MCP tool hints (v0.2.27) |
486
488
 
487
489
  ---
488
490
 
@@ -549,14 +551,15 @@ Sandbox configuration for command execution isolation.
549
551
 
550
552
  ### SandboxNetworkConfig
551
553
 
552
- | Field | TypeScript | Python | Ruby |
553
- |-----------------------|:----------:|:------:|:----:|
554
- | `allowedDomains` | ✅ | ❌ | ✅ |
555
- | `allowUnixSockets` | ✅ | | ✅ |
556
- | `allowAllUnixSockets` | ✅ | ✅ | ✅ |
557
- | `allowLocalBinding` | ✅ | ✅ | ✅ |
558
- | `httpProxyPort` | ✅ | ✅ | ✅ |
559
- | `socksProxyPort` | ✅ | ✅ | ✅ |
554
+ | Field | TypeScript | Python | Ruby |
555
+ |---------------------------|:----------:|:------:|:----:|
556
+ | `allowedDomains` | ✅ | ❌ | ✅ |
557
+ | `allowManagedDomainsOnly` | ✅ | | ✅ |
558
+ | `allowUnixSockets` | ✅ | ✅ | ✅ |
559
+ | `allowAllUnixSockets` | ✅ | ✅ | ✅ |
560
+ | `allowLocalBinding` | ✅ | ✅ | ✅ |
561
+ | `httpProxyPort` | ✅ | ✅ | ✅ |
562
+ | `socksProxyPort` | ✅ | ✅ | ✅ |
560
563
 
561
564
  ---
562
565
 
@@ -618,6 +621,7 @@ Public API surface for SDK clients.
618
621
  | `reconnectMcpServer()` | ✅ | ❌ | ✅ | Reconnect MCP server |
619
622
  | `toggleMcpServer()` | ✅ | ❌ | ✅ | Enable/disable MCP |
620
623
  | `streamInput()` | ✅ | ✅ | ✅ | Stream user input |
624
+ | `initializationResult()` | ✅ | ❌ | ✅ | Full init response |
621
625
  | `close()` | ✅ | ✅ | ✅ | Close query/session |
622
626
 
623
627
  ### Client Class
@@ -669,9 +673,11 @@ Public API surface for SDK clients.
669
673
  - Missing permission modes: `delegate`, `dontAsk`
670
674
  - Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
671
675
  - `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`
676
+ - Now has `additionalContext` in `PreToolUseHookSpecificOutput` (added in v0.1.30)
677
+ - Now has `create_sdk_mcp_server`, `tool()` helper, and MCP tool annotations (added in v0.1.30)
672
678
 
673
679
  ### Ruby SDK (This Repository)
674
- - Full TypeScript SDK v0.2.31 feature parity
680
+ - Full TypeScript SDK v0.2.32 feature parity
675
681
  - Ruby-idiomatic patterns (Data.define, snake_case)
676
682
  - Complete control protocol, hook, and V2 Session API support
677
683
  - Dedicated Client class for multi-turn conversations
@@ -268,6 +268,15 @@ module ClaudeAgent
268
268
  @protocol.account_info
269
269
  end
270
270
 
271
+ # Get full initialization result (TypeScript SDK parity)
272
+ #
273
+ # @return [InitializationResult]
274
+ def initialization_result
275
+ require_connection!
276
+
277
+ @protocol.initialization_result
278
+ end
279
+
271
280
  # Dynamically set MCP servers for this session (TypeScript SDK parity)
272
281
  #
273
282
  # This replaces the current set of dynamically-added MCP servers.
@@ -324,6 +324,51 @@ module ClaudeAgent
324
324
  end
325
325
  end
326
326
 
327
+ # Get full initialization result (TypeScript SDK parity)
328
+ #
329
+ # Sends the supported_commands request and maps the full response including
330
+ # commands, output style, available output styles, models, and account info.
331
+ #
332
+ # @return [InitializationResult]
333
+ def initialization_result
334
+ response = send_control_request(subtype: "supported_commands")
335
+
336
+ commands = (response["commands"] || []).map do |cmd|
337
+ SlashCommand.new(
338
+ name: cmd["name"],
339
+ description: cmd["description"],
340
+ argument_hint: cmd["argumentHint"]
341
+ )
342
+ end
343
+
344
+ models = (response["models"] || []).map do |model|
345
+ ModelInfo.new(
346
+ value: model["value"],
347
+ display_name: model["displayName"],
348
+ description: model["description"]
349
+ )
350
+ end
351
+
352
+ account_data = response["account"]
353
+ account = if account_data
354
+ AccountInfo.new(
355
+ email: account_data["email"],
356
+ organization: account_data["organization"],
357
+ subscription_type: account_data["subscriptionType"],
358
+ token_source: account_data["tokenSource"],
359
+ api_key_source: account_data["apiKeySource"]
360
+ )
361
+ end
362
+
363
+ InitializationResult.new(
364
+ commands: commands,
365
+ output_style: response["output_style"],
366
+ available_output_styles: response["available_output_styles"] || [],
367
+ models: models,
368
+ account: account
369
+ )
370
+ end
371
+
327
372
  # Get available models (TypeScript SDK parity)
328
373
  # @return [Array<ModelInfo>]
329
374
  def supported_models
@@ -536,7 +581,8 @@ module ClaudeAgent
536
581
  blocked_path: request["blocked_path"],
537
582
  decision_reason: request["decision_reason"],
538
583
  tool_use_id: request["tool_use_id"],
539
- agent_id: request["agent_id"]
584
+ agent_id: request["agent_id"],
585
+ description: request["description"]
540
586
  }
541
587
 
542
588
  result = options.can_use_tool.call(tool_name, input, context)
@@ -156,7 +156,8 @@ module ClaudeAgent
156
156
  :decision_reason,
157
157
  :tool_use_id,
158
158
  :agent_id,
159
- :signal
159
+ :signal,
160
+ :description
160
161
  ) do
161
162
  def initialize(
162
163
  permission_suggestions: nil,
@@ -164,7 +165,8 @@ module ClaudeAgent
164
165
  decision_reason: nil,
165
166
  tool_use_id: nil,
166
167
  agent_id: nil,
167
- signal: nil
168
+ signal: nil,
169
+ description: nil
168
170
  )
169
171
  super
170
172
  end
@@ -15,6 +15,7 @@ module ClaudeAgent
15
15
  :allow_local_binding,
16
16
  :allow_unix_sockets,
17
17
  :allow_all_unix_sockets,
18
+ :allow_managed_domains_only,
18
19
  :http_proxy_port,
19
20
  :socks_proxy_port
20
21
  ) do
@@ -23,6 +24,7 @@ module ClaudeAgent
23
24
  allow_local_binding: false,
24
25
  allow_unix_sockets: [],
25
26
  allow_all_unix_sockets: false,
27
+ allow_managed_domains_only: false,
26
28
  http_proxy_port: nil,
27
29
  socks_proxy_port: nil
28
30
  )
@@ -35,6 +37,7 @@ module ClaudeAgent
35
37
  result[:allowLocalBinding] = allow_local_binding if allow_local_binding
36
38
  result[:allowUnixSockets] = allow_unix_sockets unless allow_unix_sockets.empty?
37
39
  result[:allowAllUnixSockets] = allow_all_unix_sockets if allow_all_unix_sockets
40
+ result[:allowManagedDomainsOnly] = allow_managed_domains_only if allow_managed_domains_only
38
41
  result[:httpProxyPort] = http_proxy_port if http_proxy_port
39
42
  result[:socksProxyPort] = socks_proxy_port if socks_proxy_port
40
43
  result
@@ -80,6 +80,23 @@ module ClaudeAgent
80
80
  end
81
81
  end
82
82
 
83
+ # Composite initialization result from supported_commands request (TypeScript SDK parity)
84
+ #
85
+ # @example
86
+ # result = InitializationResult.new(
87
+ # commands: [SlashCommand.new(name: "commit")],
88
+ # output_style: "default",
89
+ # available_output_styles: ["default", "concise"],
90
+ # models: [ModelInfo.new(value: "claude-sonnet")],
91
+ # account: AccountInfo.new(email: "user@example.com")
92
+ # )
93
+ #
94
+ InitializationResult = Data.define(:commands, :output_style, :available_output_styles, :models, :account) do
95
+ def initialize(commands: [], output_style: nil, available_output_styles: [], models: [], account: nil)
96
+ super
97
+ end
98
+ end
99
+
83
100
  # Per-model usage statistics returned in result messages (TypeScript SDK parity)
84
101
  #
85
102
  # @example
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgent
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
data/sig/claude_agent.rbs CHANGED
@@ -114,6 +114,16 @@ module ClaudeAgent
114
114
  def initialize: (?email: String?, ?organization: String?, ?subscription_type: String?, ?token_source: String?, ?api_key_source: String?) -> void
115
115
  end
116
116
 
117
+ class InitializationResult
118
+ attr_reader commands: Array[SlashCommand]
119
+ attr_reader output_style: String?
120
+ attr_reader available_output_styles: Array[String]
121
+ attr_reader models: Array[ModelInfo]
122
+ attr_reader account: AccountInfo?
123
+
124
+ def initialize: (?commands: Array[SlashCommand], ?output_style: String?, ?available_output_styles: Array[String], ?models: Array[ModelInfo], ?account: AccountInfo?) -> void
125
+ end
126
+
117
127
  class ModelUsage
118
128
  attr_reader input_tokens: Integer
119
129
  attr_reader output_tokens: Integer
@@ -175,10 +185,11 @@ module ClaudeAgent
175
185
  attr_reader allow_local_binding: bool
176
186
  attr_reader allow_unix_sockets: Array[String]
177
187
  attr_reader allow_all_unix_sockets: bool
188
+ attr_reader allow_managed_domains_only: bool
178
189
  attr_reader http_proxy_port: Integer?
179
190
  attr_reader socks_proxy_port: Integer?
180
191
 
181
- def initialize: (?allowed_domains: Array[String], ?allow_local_binding: bool, ?allow_unix_sockets: Array[String], ?allow_all_unix_sockets: bool, ?http_proxy_port: Integer?, ?socks_proxy_port: Integer?) -> void
192
+ def initialize: (?allowed_domains: Array[String], ?allow_local_binding: bool, ?allow_unix_sockets: Array[String], ?allow_all_unix_sockets: bool, ?allow_managed_domains_only: bool, ?http_proxy_port: Integer?, ?socks_proxy_port: Integer?) -> void
182
193
  def to_h: () -> Hash[Symbol, untyped]
183
194
  end
184
195
 
@@ -810,8 +821,9 @@ module ClaudeAgent
810
821
  attr_reader tool_use_id: String?
811
822
  attr_reader agent_id: String?
812
823
  attr_reader signal: AbortSignal?
824
+ attr_reader description: String?
813
825
 
814
- def initialize: (?permission_suggestions: untyped, ?blocked_path: String?, ?decision_reason: String?, ?tool_use_id: String?, ?agent_id: String?, ?signal: AbortSignal?) -> void
826
+ def initialize: (?permission_suggestions: untyped, ?blocked_path: String?, ?decision_reason: String?, ?tool_use_id: String?, ?agent_id: String?, ?signal: AbortSignal?, ?description: String?) -> void
815
827
  end
816
828
 
817
829
  # Client
@@ -847,6 +859,7 @@ module ClaudeAgent
847
859
  def supported_models: () -> Array[ModelInfo]
848
860
  def mcp_server_status: () -> Array[McpServerStatus]
849
861
  def account_info: () -> AccountInfo
862
+ def initialization_result: () -> InitializationResult
850
863
  end
851
864
 
852
865
  # Control protocol
@@ -882,6 +895,7 @@ module ClaudeAgent
882
895
  def supported_models: () -> Array[ModelInfo]
883
896
  def mcp_server_status: () -> Array[McpServerStatus]
884
897
  def account_info: () -> AccountInfo
898
+ def initialization_result: () -> InitializationResult
885
899
  end
886
900
 
887
901
  # Transport layer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Carr