claude_agent 0.7.4 → 0.7.5

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: 7243ce9755ad2adeca4eee580a6011ba3a35f51f1bfe7d00a2df1f4b5313bc52
4
+ data.tar.gz: 9331f577e970716bd9c3573eaa44e6e96b8ef5c3f3798673d4ff20eef0ca23f3
5
5
  SHA512:
6
- metadata.gz: e4c7ba1adad712135d2934405b758324f2477e71b7914769deb07ba07fe4a025ca11f2c04a0ec46e3d2fe6954cf02288097ef914eb62c7874aca229aa4cd9c6c
7
- data.tar.gz: c608d6c49ffb80c0c0aa96a4dca2f042f280060a73f473e271b1b0d099a368239fedf3194264f82f825fc5d8d76dfa4986c44563929f3a83f09773af96f84654
6
+ metadata.gz: b452df3dde194a5c092f2c1cae97c5b51fea119dce3aa8fe6bfadd2607ceb27e5d1fc9ded9206ed49f92db309acb6714e7fa38365150a373ea0fb3c77c5baa66
7
+ data.tar.gz: b2016921e13e9a3c811d126f78ea545b121bc8480ecb064c23b55807a444d3db361f42e205128302d4c303de598bf5d30754fcf3169cfedaeeb2e4dfc550ca22
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.5] - 2026-02-10
11
+
12
+ ### Added
13
+ - `thinking` option for controlling extended thinking mode (`{ type: "adaptive" }`, `{ type: "enabled", budgetTokens: N }`, `{ type: "disabled" }`)
14
+ - `effort` option for response effort level (`"low"`, `"medium"`, `"high"`, `"max"`)
15
+ - `max_output_tokens` assistant message error type
16
+
10
17
  ## [0.7.4] - 2026-02-07
11
18
 
12
19
  ### 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.38 (npm package)
7
+ - Python SDK: v0.1.34 from GitHub (commit a969042)
8
8
  - Ruby SDK: This repository
9
9
 
10
- **Last Updated:** 2026-02-07
10
+ **Last Updated:** 2026-02-09
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) |
@@ -595,6 +597,7 @@ Error types and hierarchy.
595
597
  | `invalid_request` | ✅ | ✅ | ✅ |
596
598
  | `server_error` | ✅ | ✅ | ✅ |
597
599
  | `unknown` | ✅ | ✅ | ✅ |
600
+ | `max_output_tokens` | ✅ | ❌ | ✅ |
598
601
 
599
602
  ---
600
603
 
@@ -674,12 +677,12 @@ Public API surface for SDK clients.
674
677
  - Partial control protocol: query and client support interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus
675
678
  - Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted
676
679
  - Missing permission modes: `delegate`, `dontAsk`
677
- - Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
680
+ - Missing options: `thinking`, `effort`, `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
678
681
  - `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`, `description`
679
682
  - Has SDK MCP server support with `tool()` helper and annotations
680
683
 
681
684
  ### 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)
685
+ - Feature parity with TypeScript SDK v0.2.38
683
686
  - Ruby-idiomatic patterns (Data.define, snake_case)
684
687
  - Complete control protocol, hook, and V2 Session API support
685
688
  - Dedicated Client class for multi-turn conversations
@@ -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.5"
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
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Carr