claude_agent 0.7.4 → 0.7.6

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: 3d8b88e03dcf883a968958f700a7dd765fbdae8553934b45e967594ad81f9bba
4
- data.tar.gz: fd16c0e625ed0df2c548c39378e167af73a21c2fa6d7b61cacc351d9cbde78d2
3
+ metadata.gz: 461539691af2ef7a8824d3d5976a7d9741e7e41cbd1bf7d5c07fa13f7909894b
4
+ data.tar.gz: 7c56823efe8f18b0502c652e5cf3e214ed81a6a057322e871dabb4b4d19fbbc2
5
5
  SHA512:
6
- metadata.gz: e4c7ba1adad712135d2934405b758324f2477e71b7914769deb07ba07fe4a025ca11f2c04a0ec46e3d2fe6954cf02288097ef914eb62c7874aca229aa4cd9c6c
7
- data.tar.gz: c608d6c49ffb80c0c0aa96a4dca2f042f280060a73f473e271b1b0d099a368239fedf3194264f82f825fc5d8d76dfa4986c44563929f3a83f09773af96f84654
6
+ metadata.gz: 84a3b38295cab7f4d28969a73573b97028d0fd26d61e65520fc6375804e67128ea7f08678cb094a6763fffb7a837248d9f6a06e1616985af9615957d10b4d6a2
7
+ data.tar.gz: 423cda325548a65dd32780582efdcefb352c2d83b6c852d362564d0391d7287b20ab4fb9ec2aa39c0348069d451da773e95c29e34a74766b3c52434afc261563
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.6] - 2026-02-13
11
+
12
+ ### Added
13
+ - `stop_task` control request and `Client#stop_task` method for stopping running background tasks (TypeScript SDK parity)
14
+
15
+ ## [0.7.5] - 2026-02-10
16
+
17
+ ### Added
18
+ - `thinking` option for controlling extended thinking mode (`{ type: "adaptive" }`, `{ type: "enabled", budgetTokens: N }`, `{ type: "disabled" }`)
19
+ - `effort` option for response effort level (`"low"`, `"medium"`, `"high"`, `"max"`)
20
+ - `max_output_tokens` assistant message error type
21
+
10
22
  ## [0.7.4] - 2026-02-07
11
23
 
12
24
  ### 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.34 (npm package)
7
- - Python SDK: v0.1.31 from GitHub (commit 4b19642)
6
+ - TypeScript SDK: v0.2.42 (npm package)
7
+ - Python SDK: v0.1.36 from GitHub (commit 4d74748)
8
8
  - Ruby SDK: This repository
9
9
 
10
- **Last Updated:** 2026-02-07
10
+ **Last Updated:** 2026-02-13
11
11
 
12
12
  ---
13
13
 
@@ -47,7 +47,9 @@ Configuration options for SDK queries and clients.
47
47
  | `permissionPromptToolName` | ✅ | ✅ | ✅ | MCP tool for permission prompts |
48
48
  | `maxTurns` | ✅ | ✅ | ✅ | Max conversation turns |
49
49
  | `maxBudgetUsd` | ✅ | ✅ | ✅ | Max USD budget |
50
- | `maxThinkingTokens` | ✅ | ✅ | ✅ | Max thinking tokens |
50
+ | `thinking` | ✅ | ✅ | ✅ | Thinking mode config (adaptive/enabled/disabled) (v0.2.35+) |
51
+ | `effort` | ✅ | ✅ | ✅ | Response effort level (low/medium/high/max) (v0.2.35+) |
52
+ | `maxThinkingTokens` | ✅ | ✅ | ✅ | Max thinking tokens (deprecated in TS, use `thinking`) |
51
53
  | `continue` | ✅ | ✅ | ✅ | Continue most recent conversation |
52
54
  | `resume` | ✅ | ✅ | ✅ | Resume session by ID |
53
55
  | `sessionId` | ✅ | ❌ | ✅ | Custom UUID for conversations (v0.2.33) |
@@ -225,6 +227,7 @@ Bidirectional control protocol for SDK-CLI communication.
225
227
  | `mcp_status` | ✅ | ✅ | ✅ | Get MCP server status |
226
228
  | `mcp_reconnect` | ✅ | ❌ | ✅ | Reconnect to MCP server |
227
229
  | `mcp_toggle` | ✅ | ❌ | ✅ | Enable/disable MCP server |
230
+ | `stop_task` | ✅ | ❌ | ✅ | Stop a running background task |
228
231
  | `supported_commands` | ✅ | ❌ | ✅ | Get available slash commands |
229
232
  | `supported_models` | ✅ | ❌ | ✅ | Get available models |
230
233
  | `account_info` | ✅ | ❌ | ✅ | Get account information |
@@ -595,6 +598,7 @@ Error types and hierarchy.
595
598
  | `invalid_request` | ✅ | ✅ | ✅ |
596
599
  | `server_error` | ✅ | ✅ | ✅ |
597
600
  | `unknown` | ✅ | ✅ | ✅ |
601
+ | `max_output_tokens` | ✅ | ❌ | ✅ |
598
602
 
599
603
  ---
600
604
 
@@ -625,6 +629,7 @@ Public API surface for SDK clients.
625
629
  | `setMcpServers()` | ✅ | ❌ | ✅ | Dynamic MCP servers |
626
630
  | `reconnectMcpServer()` | ✅ | ❌ | ✅ | Reconnect MCP server |
627
631
  | `toggleMcpServer()` | ✅ | ❌ | ✅ | Enable/disable MCP |
632
+ | `stopTask()` | ✅ | ❌ | ✅ | Stop running task |
628
633
  | `streamInput()` | ✅ | ✅ | ✅ | Stream user input |
629
634
  | `initializationResult()` | ✅ | ❌ | ✅ | Full init response |
630
635
  | `close()` | ✅ | ✅ | ✅ | Close query/session |
@@ -677,9 +682,10 @@ Public API surface for SDK clients.
677
682
  - Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
678
683
  - `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`, `description`
679
684
  - Has SDK MCP server support with `tool()` helper and annotations
685
+ - Added `thinking` config and `effort` option in v0.1.36
680
686
 
681
687
  ### Ruby SDK (This Repository)
682
- - Full TypeScript SDK v0.2.34 feature parity (v0.2.34 contains no new SDK features beyond a Claude Code version bump)
688
+ - Full feature parity with TypeScript SDK v0.2.42
683
689
  - Ruby-idiomatic patterns (Data.define, snake_case)
684
690
  - Complete control protocol, hook, and V2 Session API support
685
691
  - Dedicated Client class for multi-turn conversations
@@ -281,6 +281,23 @@ module ClaudeAgent
281
281
  @protocol.initialization_result
282
282
  end
283
283
 
284
+ # Stop a running background task (TypeScript SDK parity)
285
+ #
286
+ # Sends a stop signal to a running task. A task_notification message
287
+ # with status 'stopped' will be emitted when the task stops.
288
+ #
289
+ # @param task_id [String] The task ID from task_notification events
290
+ # @return [void]
291
+ #
292
+ # @example
293
+ # client.stop_task("task-123")
294
+ #
295
+ def stop_task(task_id)
296
+ require_connection!
297
+
298
+ @protocol.stop_task(task_id)
299
+ end
300
+
284
301
  # Dynamically set MCP servers for this session (TypeScript SDK parity)
285
302
  #
286
303
  # This replaces the current set of dynamically-added MCP servers.
@@ -443,6 +443,21 @@ module ClaudeAgent
443
443
  send_control_request(subtype: "mcp_toggle", serverName: server_name, enabled: enabled)
444
444
  end
445
445
 
446
+ # Stop a running background task (TypeScript SDK parity)
447
+ #
448
+ # Sends a stop signal to a running task. A task_notification message
449
+ # with status 'stopped' will be emitted when the task stops.
450
+ #
451
+ # @param task_id [String] The task ID from task_notification events
452
+ # @return [void]
453
+ #
454
+ # @example
455
+ # protocol.stop_task("task-123")
456
+ #
457
+ def stop_task(task_id)
458
+ send_control_request(subtype: "stop_task", task_id: task_id)
459
+ end
460
+
446
461
  # Dynamically set MCP servers for this session (TypeScript SDK parity)
447
462
  #
448
463
  # This replaces the current set of dynamically-added MCP servers.
@@ -47,13 +47,16 @@ module ClaudeAgent
47
47
  }.freeze
48
48
 
49
49
  # All configurable attributes
50
+ # Valid effort levels for the effort option
51
+ EFFORT_LEVELS = %w[low medium high max].freeze
52
+
50
53
  ATTRIBUTES = %i[
51
54
  tools allowed_tools disallowed_tools
52
55
  system_prompt append_system_prompt
53
56
  model fallback_model
54
57
  permission_mode permission_prompt_tool_name can_use_tool allow_dangerously_skip_permissions
55
58
  continue_conversation resume fork_session resume_session_at session_id
56
- max_turns max_budget_usd max_thinking_tokens
59
+ max_turns max_budget_usd thinking effort max_thinking_tokens
57
60
  strict_mcp_config mcp_servers hooks
58
61
  settings sandbox cwd add_dirs env user agent
59
62
  cli_path extra_args agents setting_sources plugins
@@ -194,11 +197,29 @@ module ClaudeAgent
194
197
  [].tap do |args|
195
198
  args.push("--max-turns", max_turns.to_s) if max_turns
196
199
  args.push("--max-budget-usd", max_budget_usd.to_s) if max_budget_usd
197
- args.push("--max-thinking-tokens", max_thinking_tokens.to_s) if max_thinking_tokens
200
+ args.concat(thinking_args)
201
+ args.push("--max-thinking-tokens", max_thinking_tokens.to_s) if !thinking && max_thinking_tokens
202
+ args.push("--effort", effort) if effort
198
203
  args.push("--strict-mcp-config") if strict_mcp_config
199
204
  end
200
205
  end
201
206
 
207
+ def thinking_args
208
+ return [] unless thinking.is_a?(Hash)
209
+
210
+ type = thinking[:type] || thinking["type"]
211
+ case type
212
+ when "disabled"
213
+ [ "--max-thinking-tokens", "0" ]
214
+ when "enabled"
215
+ budget = thinking[:budgetTokens] || thinking[:budget_tokens] ||
216
+ thinking["budgetTokens"] || thinking["budget_tokens"]
217
+ budget ? [ "--max-thinking-tokens", budget.to_s ] : []
218
+ else # "adaptive" or unrecognized — omit flag, let CLI use default
219
+ []
220
+ end
221
+ end
222
+
202
223
  def mcp_args
203
224
  [].tap do |args|
204
225
  if mcp_servers.is_a?(Hash) && mcp_servers.any?
@@ -301,6 +322,20 @@ module ClaudeAgent
301
322
  raise ConfigurationError, "max_budget_usd must be a positive number"
302
323
  end
303
324
 
325
+ if thinking
326
+ unless thinking.is_a?(Hash)
327
+ raise ConfigurationError, "thinking must be a Hash with :type key (e.g., { type: 'adaptive' })"
328
+ end
329
+ type = thinking[:type] || thinking["type"]
330
+ unless %w[adaptive enabled disabled].include?(type)
331
+ raise ConfigurationError, "thinking[:type] must be one of: adaptive, enabled, disabled"
332
+ end
333
+ end
334
+
335
+ if effort && !EFFORT_LEVELS.include?(effort)
336
+ raise ConfigurationError, "Invalid effort: #{effort}. Must be one of: #{EFFORT_LEVELS.join(", ")}"
337
+ end
338
+
304
339
  if session_id && (continue_conversation || resume) && !fork_session
305
340
  raise ConfigurationError, "session_id cannot be used with continue or resume unless fork_session is also set"
306
341
  end
@@ -10,6 +10,7 @@ module ClaudeAgent
10
10
  invalid_request
11
11
  server_error
12
12
  unknown
13
+ max_output_tokens
13
14
  ].freeze
14
15
 
15
16
  # API key source types (TypeScript SDK parity)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgent
4
- VERSION = "0.7.4"
4
+ VERSION = "0.7.6"
5
5
  end
data/sig/claude_agent.rbs CHANGED
@@ -262,6 +262,7 @@ module ClaudeAgent
262
262
  # Constants
263
263
  DEFAULTS: Hash[Symbol, untyped]
264
264
  ATTRIBUTES: Array[Symbol]
265
+ EFFORT_LEVELS: Array[String]
265
266
 
266
267
  # Tool configuration
267
268
  attr_accessor tools: (Array[String] | String)?
@@ -293,6 +294,8 @@ module ClaudeAgent
293
294
  # Limits & budget
294
295
  attr_accessor max_turns: Integer?
295
296
  attr_accessor max_budget_usd: Float?
297
+ attr_accessor thinking: Hash[Symbol | String, untyped]?
298
+ attr_accessor effort: String?
296
299
  attr_accessor max_thinking_tokens: Integer?
297
300
 
298
301
  # Strict validation
@@ -907,6 +910,7 @@ module ClaudeAgent
907
910
  def set_mcp_servers: (Hash[String, untyped] servers) -> McpSetServersResult
908
911
  def mcp_reconnect: (String server_name) -> Hash[String, untyped]
909
912
  def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
913
+ def stop_task: (String task_id) -> Hash[String, untyped]
910
914
  def supported_commands: () -> Array[SlashCommand]
911
915
  def supported_models: () -> Array[ModelInfo]
912
916
  def mcp_server_status: () -> Array[McpServerStatus]
@@ -943,6 +947,7 @@ module ClaudeAgent
943
947
  def set_mcp_servers: (Hash[String, untyped] servers) -> McpSetServersResult
944
948
  def mcp_reconnect: (String server_name) -> Hash[String, untyped]
945
949
  def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
950
+ def stop_task: (String task_id) -> Hash[String, untyped]
946
951
  def supported_commands: () -> Array[SlashCommand]
947
952
  def supported_models: () -> Array[ModelInfo]
948
953
  def mcp_server_status: () -> Array[McpServerStatus]
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.4
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Carr