claude_agent 0.7.11 → 0.7.12

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: 965fad355090a487a22e76e097ed84aa7426fe4db396a28e0165e6ceaa09b1e2
4
- data.tar.gz: fe03eeffb6dfa608c5a40bc55d1b04b31f30bd0ec5d8a50322b2dc7bf127bdea
3
+ metadata.gz: 22706a6a24af11c5f24404ee12add5ff617a6c293e5869c5437d295f6314c9dd
4
+ data.tar.gz: e55b7eaba0ede01618c88971992651c5f4d09253333b31abf6ff52fb52098464
5
5
  SHA512:
6
- metadata.gz: b7353c7235415c842e29ba73c315f10ba52d6731324d0e326ecfe56f321272246a6877f07fd2e451007b3ac9252c007f312da15650c77f8ef4c99d06a1e907d1
7
- data.tar.gz: ece71bf88dddd47d40da3dd13e660c8e39eba12484daaf1fa0b87731ff130b8b6ddfcb215e352d2f34c587eb55998a9d1669bbe88363a2587e342190c5b80c0e
6
+ metadata.gz: 325f9c1e944e5eaaa51f7a5ae1029e1bf93016ce8abcfd9983185771830b9be2d560093a1c42d70dd1a9755b1c501dbad2f4e46e873dc3b7c424677c3280d5e4
7
+ data.tar.gz: 9bddde78dec0a0dd251cc9fc77c6379b9206469e18ce4310d6e444b231e4f65ce137235d89422778e2a2bd09b258254801479ea98ea3092bdef7b0c855fccafc
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.12] - 2026-02-27
11
+
12
+ ### Added
13
+ - `ResultMessage#uuid` field (TypeScript SDK parity — every other message type already had it)
14
+ - `sdkMcpServers` is now sent in the initialize request when SDK MCP servers are configured (TypeScript SDK parity)
15
+ - `abort!` now sends `control_cancel_request` for each pending request before failing them locally (TypeScript SDK parity)
16
+
10
17
  ## [0.7.11] - 2026-02-27
11
18
 
12
19
  ### Added
data/README.md CHANGED
@@ -488,6 +488,7 @@ message.has_tool_use? # Check if tools are being used
488
488
  Final message with usage statistics:
489
489
 
490
490
  ```ruby
491
+ result.uuid # Message UUID
491
492
  result.session_id # Session identifier
492
493
  result.num_turns # Number of conversation turns
493
494
  result.duration_ms # Total duration in milliseconds
data/SPEC.md CHANGED
@@ -199,6 +199,62 @@ Messages exchanged between SDK and CLI.
199
199
  | `stdout` | ✅ | ❌ | ✅ | Standard output so far |
200
200
  | `stderr` | ✅ | ❌ | ✅ | Standard error so far |
201
201
 
202
+ #### TaskStartedMessage
203
+
204
+ | Field | TypeScript | Python | Ruby | Notes |
205
+ |---------------|:----------:|:------:|:----:|-------------------------|
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) |
210
+
211
+ #### TaskProgressMessage
212
+
213
+ | Field | TypeScript | Python | Ruby | Notes |
214
+ |------------------|:----------:|:------:|:----:|---------------------------------------------------|
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 |
220
+
221
+ #### AuthStatusMessage
222
+
223
+ | Field | TypeScript | Python | Ruby | Notes |
224
+ |--------------------|:----------:|:------:|:----:|-------------------------|
225
+ | `isAuthenticating` | ✅ | ❌ | ✅ | Authentication active |
226
+ | `output` | ✅ | ❌ | ✅ | Auth output messages |
227
+ | `error` | ✅ | ❌ | ✅ | Auth error message |
228
+
229
+ #### ToolUseSummaryMessage
230
+
231
+ | Field | TypeScript | Python | Ruby | Notes |
232
+ |--------------------------|:----------:|:------:|:----:|-------------------------------|
233
+ | `summary` | ✅ | ❌ | ✅ | Summary text |
234
+ | `preceding_tool_use_ids` | ✅ | ❌ | ✅ | Tool use IDs being summarized |
235
+
236
+ #### RateLimitEvent
237
+
238
+ | Field | TypeScript | Python | Ruby | Notes |
239
+ |-------------------|:----------:|:------:|:----:|---------------------------------|
240
+ | `rate_limit_info` | ✅ | ❌ | ✅ | Rate limit details object |
241
+
242
+ Rate limit info contains: `status`, `resetsAt`, `rateLimitType`, `utilization`, `isUsingOverage`, `overageStatus`.
243
+
244
+ #### PromptSuggestionMessage
245
+
246
+ | Field | TypeScript | Python | Ruby | Notes |
247
+ |--------------|:----------:|:------:|:----:|-------------------------|
248
+ | `suggestion` | ✅ | ❌ | ✅ | Suggested next prompt |
249
+
250
+ #### FilesPersistedEvent
251
+
252
+ | Field | TypeScript | Python | Ruby | Notes |
253
+ |----------------|:----------:|:------:|:----:|--------------------------------------------|
254
+ | `files` | ✅ | ❌ | ✅ | Successfully persisted {filename, file_id} |
255
+ | `failed` | ✅ | ❌ | ✅ | Failed files {filename, error} |
256
+ | `processed_at` | ✅ | ❌ | ✅ | Processing timestamp |
257
+
202
258
  ---
203
259
 
204
260
  ## 3. Content Blocks
@@ -240,28 +296,28 @@ Bidirectional control protocol for SDK-CLI communication.
240
296
 
241
297
  ### Control Request Types
242
298
 
243
- | Request Subtype | TypeScript | Python | Ruby | Notes |
244
- |---------------------------|:----------:|:------:|:----:|-----------------------------------|
245
- | `initialize` | ✅ | ✅ | ✅ | Initialize session with hooks/MCP |
246
- | `interrupt` | ✅ | ✅ | ✅ | Interrupt current operation |
247
- | `can_use_tool` | ✅ | ✅ | ✅ | Permission callback |
248
- | `hook_callback` | ✅ | ✅ | ✅ | Execute hook callback |
249
- | `set_permission_mode` | ✅ | ✅ | ✅ | Change permission mode |
250
- | `set_model` | ✅ | ✅ | ✅ | Change model |
251
- | `set_max_thinking_tokens` | ✅ | ❌ | ✅ | Change thinking tokens limit |
252
- | `rewind_files` | ✅ | ✅ | ✅ | Rewind file checkpoints |
253
- | `mcp_message` | ✅ | ✅ | ✅ | Route MCP message |
254
- | `mcp_set_servers` | ✅ | ❌ | ✅ | Dynamically set MCP servers |
255
- | `mcp_status` | ✅ | ✅ | ✅ | Get MCP server status |
256
- | `mcp_reconnect` | ✅ | ❌ | ✅ | Reconnect to MCP server |
257
- | `mcp_toggle` | ✅ | ❌ | ✅ | Enable/disable MCP server |
258
- | `stop_task` | ✅ | ❌ | ✅ | Stop a running background task |
259
- | `mcp_authenticate` | ✅ | ❌ | ✅ | Authenticate MCP server (v0.2.52) |
260
- | `mcp_clear_auth` | ✅ | ❌ | ✅ | Clear MCP server auth (v0.2.52) |
261
- | `supported_commands` | ✅ | ❌ | ✅ | Get available slash commands |
262
- | `supported_models` | ✅ | ❌ | ✅ | Get available models |
263
- | `account_info` | ✅ | ❌ | ✅ | Get account information |
264
- | `apply_flag_settings` | ✅ | ❌ | ✅ | Merge settings into flag layer |
299
+ | Request Subtype | TypeScript | Python | Ruby | Notes |
300
+ |---------------------------|:----------:|:------:|:----:|--------------------------------------------|
301
+ | `initialize` | ✅ | ✅ | ✅ | Initialize session with hooks/MCP |
302
+ | `interrupt` | ✅ | ✅ | ✅ | Interrupt current operation |
303
+ | `can_use_tool` | ✅ | ✅ | ✅ | Permission callback |
304
+ | `hook_callback` | ✅ | ✅ | ✅ | Execute hook callback |
305
+ | `set_permission_mode` | ✅ | ✅ | ✅ | Change permission mode |
306
+ | `set_model` | ✅ | ✅ | ✅ | Change model |
307
+ | `set_max_thinking_tokens` | ✅ | ❌ | ✅ | Change thinking tokens limit |
308
+ | `rewind_files` | ✅ | ✅ | ✅ | Rewind file checkpoints (supports dry_run) |
309
+ | `mcp_message` | ✅ | ✅ | ✅ | Route MCP message |
310
+ | `mcp_set_servers` | ✅ | ❌ | ✅ | Dynamically set MCP servers |
311
+ | `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 |
315
+ | `mcp_authenticate` | ✅ | ❌ | ✅ | Authenticate MCP server (v0.2.52) |
316
+ | `mcp_clear_auth` | ✅ | ❌ | ✅ | Clear MCP server auth (v0.2.52) |
317
+ | `supported_commands` | ✅ | ❌ | ✅ | Get available slash commands |
318
+ | `supported_models` | ✅ | ❌ | ✅ | Get available models |
319
+ | `account_info` | ✅ | ❌ | ✅ | Get account information |
320
+ | `apply_flag_settings` | ✅ | ❌ | ✅ | Merge settings into flag layer |
265
321
 
266
322
  ### Return Types
267
323
 
@@ -298,6 +354,34 @@ Bidirectional control protocol for SDK-CLI communication.
298
354
  | `scope` | ✅ | ❌ | ✅ | Config scope (project, user, etc.) |
299
355
  | `tools` | ✅ | ❌ | ✅ | Tools with annotations |
300
356
 
357
+ #### InitializationResult Fields
358
+
359
+ | Field | TypeScript | Python | Ruby | Notes |
360
+ |---------------------------|:----------:|:------:|:----:|-----------------------------------|
361
+ | `commands` | ✅ | ❌ | ✅ | Available slash commands |
362
+ | `output_style` | ✅ | ❌ | ✅ | Current output style |
363
+ | `available_output_styles` | ✅ | ❌ | ✅ | All available output styles |
364
+ | `models` | ✅ | ❌ | ✅ | Available models (ModelInfo[]) |
365
+ | `account` | ✅ | ❌ | ✅ | Account information (AccountInfo) |
366
+
367
+ #### RewindFilesResult Fields
368
+
369
+ | Field | TypeScript | Python | Ruby | Notes |
370
+ |----------------|:----------:|:------:|:----:|-------------------------------|
371
+ | `canRewind` | ✅ | ✅ | ✅ | Whether rewind is possible |
372
+ | `error` | ✅ | ❌ | ✅ | Error message if can't rewind |
373
+ | `filesChanged` | ✅ | ❌ | ✅ | List of changed file paths |
374
+ | `insertions` | ✅ | ❌ | ✅ | Number of line insertions |
375
+ | `deletions` | ✅ | ❌ | ✅ | Number of line deletions |
376
+
377
+ #### McpSetServersResult Fields
378
+
379
+ | Field | TypeScript | Python | Ruby | Notes |
380
+ |-----------|:----------:|:------:|:----:|-----------------------------------|
381
+ | `added` | ✅ | ❌ | ✅ | Server names that were added |
382
+ | `removed` | ✅ | ❌ | ✅ | Server names that were removed |
383
+ | `errors` | ✅ | ❌ | ✅ | Map of server name to error |
384
+
301
385
  ---
302
386
 
303
387
  ## 5. Hooks
@@ -561,6 +645,14 @@ Model Context Protocol server support.
561
645
  | `name` | ✅ | ✅ | ✅ |
562
646
  | `instance` | ✅ | ✅ | ✅ |
563
647
 
648
+ #### claudeai-proxy
649
+
650
+ | Field | TypeScript | Python | Ruby |
651
+ |--------|:----------:|:------:|:----:|
652
+ | `type` | ✅ | ❌ | ✅ |
653
+ | `url` | ✅ | ❌ | ✅ |
654
+ | `id` | ✅ | ❌ | ✅ |
655
+
564
656
  ### SDK MCP Server
565
657
 
566
658
  | Feature | TypeScript | Python | Ruby | Notes |
@@ -99,6 +99,17 @@ module ClaudeAgent
99
99
  # Drain permission queue so reader thread unblocks
100
100
  @permission_queue&.drain!(reason: "Operation aborted")
101
101
 
102
+ # Send cancel requests for pending operations (protocol courtesy)
103
+ @mutex.synchronize do
104
+ @pending_requests.each_key do |request_id|
105
+ begin
106
+ write_message({ type: "control_cancel_request", request_id: request_id })
107
+ rescue
108
+ # Ignore transport errors during abort — fire-and-forget
109
+ end
110
+ end
111
+ end
112
+
102
113
  # Fail all pending requests
103
114
  @mutex.synchronize do
104
115
  @pending_requests.each_key do |request_id|
@@ -585,10 +596,20 @@ module ClaudeAgent
585
596
  request = { subtype: "initialize" }
586
597
  request[:hooks] = hooks_config if hooks_config
587
598
  request[:promptSuggestions] = true if options.prompt_suggestions
599
+ request[:sdkMcpServers] = sdk_mcp_server_names if options.has_sdk_mcp_servers?
588
600
 
589
601
  send_control_request(**request)
590
602
  end
591
603
 
604
+ # Extract SDK MCP server names from options
605
+ # @return [Array<String>]
606
+ def sdk_mcp_server_names
607
+ options.mcp_servers
608
+ .select { |_, v| v.is_a?(Hash) && v[:type] == "sdk" }
609
+ .keys
610
+ .map(&:to_s)
611
+ end
612
+
592
613
  # Build hooks configuration for initialization
593
614
  # @return [Hash, nil]
594
615
  def build_hooks_config
@@ -159,6 +159,7 @@ module ClaudeAgent
159
159
  is_error: raw[:is_error] || false,
160
160
  num_turns: raw[:num_turns] || 0,
161
161
  session_id: raw[:session_id] || "",
162
+ uuid: raw[:uuid],
162
163
  total_cost_usd: raw[:total_cost_usd],
163
164
  usage: raw[:usage],
164
165
  result: raw[:result],
@@ -175,6 +175,7 @@ module ClaudeAgent
175
175
  :is_error,
176
176
  :num_turns,
177
177
  :session_id,
178
+ :uuid,
178
179
  :total_cost_usd,
179
180
  :usage,
180
181
  :result,
@@ -191,6 +192,7 @@ module ClaudeAgent
191
192
  is_error:,
192
193
  num_turns:,
193
194
  session_id:,
195
+ uuid: nil,
194
196
  total_cost_usd: nil,
195
197
  usage: nil,
196
198
  result: nil,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgent
4
- VERSION = "0.7.11"
4
+ VERSION = "0.7.12"
5
5
  end
data/sig/claude_agent.rbs CHANGED
@@ -591,6 +591,7 @@ module ClaudeAgent
591
591
  attr_reader is_error: bool
592
592
  attr_reader num_turns: Integer
593
593
  attr_reader session_id: String
594
+ attr_reader uuid: String?
594
595
  attr_reader total_cost_usd: Float?
595
596
  attr_reader usage: Hash[String, untyped]?
596
597
  attr_reader result: String?
@@ -607,6 +608,7 @@ module ClaudeAgent
607
608
  is_error: bool,
608
609
  num_turns: Integer,
609
610
  session_id: String,
611
+ ?uuid: String?,
610
612
  ?total_cost_usd: Float?,
611
613
  ?usage: Hash[String, untyped]?,
612
614
  ?result: String?,
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.11
4
+ version: 0.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Carr