claude-agent-sdk 0.33.0 → 0.33.1

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: c5c70ede77de755091c7587cb3bed3ea95075ed6db34b7a2cc4e3214db9adcb5
4
- data.tar.gz: b4d77a1e0888dc0ef3e436e933ee2334d6912b087e440fb88af0765e34703e10
3
+ metadata.gz: 6994a2674fc098001857cff72a21c3d804744c6fa25cb866f2a133ee1a2ec876
4
+ data.tar.gz: 349b7ce2314eac4c315e3c3d03ef0e466926fe3abb0f8823d1780f1486a8ce0d
5
5
  SHA512:
6
- metadata.gz: '0658614c047b36d2cd7c8724c01e31b1bdcb4aac81246caf6e56c7afb9e8203bf2e7cedfd112c59c317fb0cd5359785737e8a4e33efa67f448ee47792a81fc17'
7
- data.tar.gz: 2938e8804ee6396fdadb60be8345da7317628f853ec35947aba5f8542c732346d4a360aa0222f57977d18578e3689e0307d55337802f908ce4eed85543518122
6
+ metadata.gz: 0442feb3be095e8be7903e55e51f5620607b682cb0ed57f1ded989f01f6bf04bf22cee36556b52fd8cb4072d2e3bf4a2400c459b8cad231a83590d75b1010403
7
+ data.tar.gz: e287cd5825a5e16f1c8d7ce8295d0f3fba07ee15c5e4502be2dbfefcd223cf061c6e20afe5e5e6349e7ee2729c8c70e77aea152c6b95dc997978bc5ef358f68e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.33.1] - 2026-09-21
11
+
12
+ Compatibility with `json` 3.x and `mcp` 1.x. Upgrade if your bundle resolves `json` 3.x — `rename_session` / `tag_session` raise on 0.33.0.
13
+
14
+ ### Changed
15
+ - `mcp` dependency is now `>= 0.20, < 2` (was `>= 0.6, < 1`). The floor moves to 0.20 because `mcp` 0.19 and older validate through the `json-schema` gem, which breaks under `json` 3.x and fails every SDK MCP `tools/call`; with `json` 2.x those versions still pass, so this only forces an `mcp` upgrade on bundles pinned below 0.20. The suite passes against every 1.x release through 1.6.0, and `initialize` / `tools/list` / `tools/call` / `resources/*` / `prompts/*` wire output is byte-identical to 0.2x.
16
+ - SDK MCP tool handler exceptions now reach the model as the bare exception message (matching Python's `str(e)` and `SdkMcpServer#call_tool`) instead of the gem's `Internal error calling tool X: msg`. The exception is rescued inside the SDK's tool class, so the text no longer depends on the `mcp` gem version — `mcp` 1.2+ redacts the message from its own wrapper, which would otherwise have left the model with no error text to self-correct from. Still in-band `isError: true`.
17
+
18
+ ### Fixed
19
+ - `rename_session` / `tag_session` raised `ArgumentError: unknown keyword: space_size` under `json` 3.x, which takes generator options as strict keywords. The option was a no-op on `json` 2.x (output unchanged), so it is simply gone. A fresh end-user bundle resolves `json` 3.x through `async → console → json`; CI missed it only because the dev-only RuboCop pin holds `json` at 2.x.
20
+
10
21
  ## [0.33.0] - 2026-09-21
11
22
 
12
23
  Subagent capabilities for UI builders: metadata reads, background snapshots, cooperative callback cancellation, and the task/background/permission signals the CLI already emits — all raw data and controls, no status model. Ruby-ahead of the Python SDK (0.2.153).
data/README.md CHANGED
@@ -27,7 +27,7 @@ A Ruby SDK for the [Claude Code](https://docs.claude.com/en/docs/claude-code-ove
27
27
 
28
28
  ```ruby
29
29
  # Gemfile
30
- gem 'claude-agent-sdk', '~> 0.33.0'
30
+ gem 'claude-agent-sdk', '~> 0.33.1'
31
31
  ```
32
32
 
33
33
  Then `bundle install`, or install directly with `gem install claude-agent-sdk`. To track unreleased changes, point the Gemfile at GitHub: `gem 'claude-agent-sdk', github: 'ya-luotao/claude-agent-sdk-ruby'`.
@@ -1195,9 +1195,12 @@ module ClaudeAgentSDK
1195
1195
  # server validates arguments against the tool's inputSchema BEFORE the
1196
1196
  # handler runs and reports validation failures, unknown tools, and
1197
1197
  # handler exceptions as in-band isError results). tools/list,
1198
- # initialize, resources/* and prompts/* stay on the SDK paths — the
1199
- # gem drops annotations/_meta from tools/list and negotiates newer
1200
- # protocol versions.
1198
+ # initialize, resources/* and prompts/* stay on the SDK paths: the
1199
+ # gem's tools/list injects "$schema" and drops `required: []` (and
1200
+ # would advertise the empty fallback schema where the SDK advertises
1201
+ # the user's own), and its initialize negotiates newer protocol
1202
+ # versions and advertises prompts/resources/logging even for a
1203
+ # tools-only server. Annotations/_meta do survive the gem path.
1201
1204
  server.handle_message(message)
1202
1205
  end
1203
1206
 
@@ -453,6 +453,16 @@ module ClaudeAgentSDK
453
453
  error: !!is_error,
454
454
  structured_content: structured_content
455
455
  )
456
+ rescue StandardError => e
457
+ # Report handler failures in-band HERE rather than letting them
458
+ # reach the gem: mcp >= 1.2 deliberately drops e.message from
459
+ # its "Internal error calling tool X" wrapper (CWE-209), which
460
+ # would hide the text the model needs to self-correct. Bare
461
+ # e.message like Python's str(e) and #call_tool — no prefix.
462
+ # Nothing gem-internal can be swallowed here today: handlers get
463
+ # no server_context, so MCP::CancelledError never originates
464
+ # inside this method. Revisit if cancellation is ever plumbed in.
465
+ MCP::Tool::Response.new([{ type: 'text', text: e.message }], error: true)
456
466
  end
457
467
  end
458
468
  end
@@ -38,8 +38,7 @@ module ClaudeAgentSDK
38
38
  stripped = title.strip
39
39
  raise ArgumentError, 'title must be non-empty' if stripped.empty?
40
40
 
41
- data = "#{JSON.generate({ type: 'custom-title', customTitle: stripped, sessionId: session_id },
42
- space_size: 0)}\n"
41
+ data = "#{JSON.generate({ type: 'custom-title', customTitle: stripped, sessionId: session_id })}\n"
43
42
 
44
43
  append_to_session(session_id, data, directory)
45
44
  end
@@ -64,8 +63,7 @@ module ClaudeAgentSDK
64
63
  tag = sanitized
65
64
  end
66
65
 
67
- data = "#{JSON.generate({ type: 'tag', tag: tag || '', sessionId: session_id },
68
- space_size: 0)}\n"
66
+ data = "#{JSON.generate({ type: 'tag', tag: tag || '', sessionId: session_id })}\n"
69
67
 
70
68
  append_to_session(session_id, data, directory)
71
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgentSDK
4
- VERSION = '0.33.0'
4
+ VERSION = '0.33.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-agent-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.0
4
+ version: 0.33.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Community Contributors
@@ -30,20 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0.20'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '1'
36
+ version: '2'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '0.6'
43
+ version: '0.20'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '1'
46
+ version: '2'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement