claude-agent-sdk 0.8.1 → 0.9.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52b6649f2a72ef33e746d168e4016dcc72c1439157fbe5b971edbd55b0a0d404
|
|
4
|
+
data.tar.gz: a344cc38d96ef7185630c1e1518a5cf6d08a855f40b39092728236d5a48df50d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18a32d856585a36aa39a9aa586829a305c099cd4686a338e6f1df5310490abb81808821940a6be5d6c830a1fc86cb1cd95dab5ca8e2c5737574e3e91da513f5f
|
|
7
|
+
data.tar.gz: c6dadb9b32d373e1fac9246b5bafc8456f3779cf0187abceb7bd85ecdd96b823c95c49c751db9bcd4b384ceb34141057b9e48d4540366d1e3d7d951a69e0aa7f
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.9.0] - 2026-03-12
|
|
9
|
+
|
|
10
|
+
Port of Python SDK v0.1.48 parity improvements.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
#### Typed Rate Limit Events
|
|
15
|
+
- `RateLimitInfo` class with `status`, `resets_at`, `rate_limit_type`, `utilization`, `overage_status`, `overage_resets_at`, `overage_disabled_reason`, `raw` attributes
|
|
16
|
+
- `RATE_LIMIT_STATUSES` constant (`allowed`, `allowed_warning`, `rejected`)
|
|
17
|
+
- `RATE_LIMIT_TYPES` constant (`five_hour`, `seven_day`, `seven_day_opus`, `seven_day_sonnet`, `overage`)
|
|
18
|
+
- `RateLimitEvent` now has typed `rate_limit_info`, `uuid`, `session_id` attributes (previously raw `data` hash)
|
|
19
|
+
- Backward-compatible `data` accessor on `RateLimitEvent` returns raw hash from `rate_limit_info.raw`
|
|
20
|
+
|
|
21
|
+
#### MCP Status Output Types
|
|
22
|
+
- `McpClaudeAIProxyServerConfig` type for `claudeai-proxy` servers in MCP status responses
|
|
23
|
+
- `McpSdkServerConfigStatus` type for serializable SDK server config in status responses
|
|
24
|
+
- `McpServerStatus.parse` handles `claudeai-proxy` config type
|
|
25
|
+
|
|
26
|
+
#### Effort Level
|
|
27
|
+
- `effort` option now supports `"max"` value in addition to `"low"`, `"medium"`, `"high"`
|
|
28
|
+
|
|
8
29
|
## [0.8.1] - 2026-03-08
|
|
9
30
|
|
|
10
31
|
Python SDK parity fixes for one-shot `query()` control protocol and CLI transport.
|
|
@@ -120,7 +120,23 @@ module ClaudeAgentSDK
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
def self.parse_rate_limit_event(data)
|
|
123
|
-
|
|
123
|
+
info = data[:rate_limit_info] || {}
|
|
124
|
+
rate_limit_info = RateLimitInfo.new(
|
|
125
|
+
status: info[:status],
|
|
126
|
+
resets_at: info[:resetsAt],
|
|
127
|
+
rate_limit_type: info[:rateLimitType],
|
|
128
|
+
utilization: info[:utilization],
|
|
129
|
+
overage_status: info[:overageStatus],
|
|
130
|
+
overage_resets_at: info[:overageResetsAt],
|
|
131
|
+
overage_disabled_reason: info[:overageDisabledReason],
|
|
132
|
+
raw: info
|
|
133
|
+
)
|
|
134
|
+
RateLimitEvent.new(
|
|
135
|
+
rate_limit_info: rate_limit_info,
|
|
136
|
+
uuid: data[:uuid],
|
|
137
|
+
session_id: data[:session_id],
|
|
138
|
+
raw_data: data
|
|
139
|
+
)
|
|
124
140
|
end
|
|
125
141
|
|
|
126
142
|
def self.parse_content_block(block)
|
|
@@ -75,14 +75,14 @@ module ClaudeAgentSDK
|
|
|
75
75
|
elsif @options.system_prompt.is_a?(String)
|
|
76
76
|
cmd.concat(['--system-prompt', @options.system_prompt])
|
|
77
77
|
elsif @options.system_prompt.is_a?(SystemPromptPreset)
|
|
78
|
-
|
|
78
|
+
# Preset activates the default Claude Code system prompt by not passing --system-prompt ""
|
|
79
|
+
# Only --append-system-prompt is passed if append text is provided
|
|
79
80
|
cmd.concat(['--append-system-prompt', @options.system_prompt.append]) if @options.system_prompt.append
|
|
80
81
|
elsif @options.system_prompt.is_a?(Hash)
|
|
81
82
|
prompt_type = @options.system_prompt[:type] || @options.system_prompt['type']
|
|
82
83
|
if prompt_type == 'preset'
|
|
83
|
-
preset = @options.system_prompt[:preset] || @options.system_prompt['preset']
|
|
84
84
|
append = @options.system_prompt[:append] || @options.system_prompt['append']
|
|
85
|
-
|
|
85
|
+
# Preset activates the default Claude Code system prompt by not passing --system-prompt ""
|
|
86
86
|
cmd.concat(['--append-system-prompt', append]) if append
|
|
87
87
|
end
|
|
88
88
|
end
|
|
@@ -107,7 +107,7 @@ module ClaudeAgentSDK
|
|
|
107
107
|
thinking_tokens = resolve_thinking_tokens
|
|
108
108
|
cmd.concat(['--max-thinking-tokens', thinking_tokens.to_s]) unless thinking_tokens.nil?
|
|
109
109
|
|
|
110
|
-
# Effort level
|
|
110
|
+
# Effort level (valid values: low, medium, high, max)
|
|
111
111
|
cmd.concat(['--effort', @options.effort.to_s]) if @options.effort
|
|
112
112
|
|
|
113
113
|
# Betas option for enabling experimental features
|
|
@@ -212,12 +212,44 @@ module ClaudeAgentSDK
|
|
|
212
212
|
end
|
|
213
213
|
end
|
|
214
214
|
|
|
215
|
-
#
|
|
215
|
+
# Type constants for rate limit statuses
|
|
216
|
+
RATE_LIMIT_STATUSES = %w[allowed allowed_warning rejected].freeze
|
|
217
|
+
|
|
218
|
+
# Type constants for rate limit types
|
|
219
|
+
RATE_LIMIT_TYPES = %w[five_hour seven_day seven_day_opus seven_day_sonnet overage].freeze
|
|
220
|
+
|
|
221
|
+
# Rate limit info with typed fields
|
|
222
|
+
class RateLimitInfo
|
|
223
|
+
attr_accessor :status, :resets_at, :rate_limit_type, :utilization,
|
|
224
|
+
:overage_status, :overage_resets_at, :overage_disabled_reason, :raw
|
|
225
|
+
|
|
226
|
+
def initialize(status:, resets_at: nil, rate_limit_type: nil, utilization: nil,
|
|
227
|
+
overage_status: nil, overage_resets_at: nil, overage_disabled_reason: nil, raw: {})
|
|
228
|
+
@status = status
|
|
229
|
+
@resets_at = resets_at
|
|
230
|
+
@rate_limit_type = rate_limit_type
|
|
231
|
+
@utilization = utilization
|
|
232
|
+
@overage_status = overage_status
|
|
233
|
+
@overage_resets_at = overage_resets_at
|
|
234
|
+
@overage_disabled_reason = overage_disabled_reason
|
|
235
|
+
@raw = raw
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Rate limit event emitted when rate limit info changes
|
|
216
240
|
class RateLimitEvent
|
|
217
|
-
attr_accessor :
|
|
241
|
+
attr_accessor :rate_limit_info, :uuid, :session_id
|
|
218
242
|
|
|
219
|
-
def initialize(
|
|
220
|
-
@
|
|
243
|
+
def initialize(rate_limit_info:, uuid:, session_id:, raw_data: nil)
|
|
244
|
+
@rate_limit_info = rate_limit_info
|
|
245
|
+
@uuid = uuid
|
|
246
|
+
@session_id = session_id
|
|
247
|
+
@raw_data = raw_data
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Backward-compatible accessor returning the full raw event payload
|
|
251
|
+
def data
|
|
252
|
+
@raw_data || {}
|
|
221
253
|
end
|
|
222
254
|
end
|
|
223
255
|
|
|
@@ -753,6 +785,37 @@ module ClaudeAgentSDK
|
|
|
753
785
|
end
|
|
754
786
|
end
|
|
755
787
|
|
|
788
|
+
# Output-only serializable version of McpSdkServerConfig (without live instance)
|
|
789
|
+
# Returned in MCP status responses
|
|
790
|
+
class McpSdkServerConfigStatus
|
|
791
|
+
attr_accessor :type, :name
|
|
792
|
+
|
|
793
|
+
def initialize(type: 'sdk', name:)
|
|
794
|
+
@type = type
|
|
795
|
+
@name = name
|
|
796
|
+
end
|
|
797
|
+
|
|
798
|
+
def to_h
|
|
799
|
+
{ type: @type, name: @name }
|
|
800
|
+
end
|
|
801
|
+
end
|
|
802
|
+
|
|
803
|
+
# Claude.ai proxy MCP server config
|
|
804
|
+
# Output-only type that appears in status responses for servers proxied through Claude.ai
|
|
805
|
+
class McpClaudeAIProxyServerConfig
|
|
806
|
+
attr_accessor :type, :url, :id
|
|
807
|
+
|
|
808
|
+
def initialize(type: 'claudeai-proxy', url:, id:)
|
|
809
|
+
@type = type
|
|
810
|
+
@url = url
|
|
811
|
+
@id = id
|
|
812
|
+
end
|
|
813
|
+
|
|
814
|
+
def to_h
|
|
815
|
+
{ type: @type, url: @url, id: @id }
|
|
816
|
+
end
|
|
817
|
+
end
|
|
818
|
+
|
|
756
819
|
# Status of a single MCP server connection
|
|
757
820
|
class McpServerStatus
|
|
758
821
|
attr_accessor :name, :status, :server_info, :error, :config, :scope, :tools
|
|
@@ -770,17 +833,31 @@ module ClaudeAgentSDK
|
|
|
770
833
|
def self.parse(data)
|
|
771
834
|
server_info = (McpServerInfo.new(name: data[:serverInfo][:name], version: data[:serverInfo][:version]) if data[:serverInfo])
|
|
772
835
|
tools = data[:tools]&.map { |t| McpToolInfo.parse(t) }
|
|
836
|
+
config = parse_config(data[:config])
|
|
773
837
|
|
|
774
838
|
new(
|
|
775
839
|
name: data[:name],
|
|
776
840
|
status: data[:status],
|
|
777
841
|
server_info: server_info,
|
|
778
842
|
error: data[:error],
|
|
779
|
-
config:
|
|
843
|
+
config: config,
|
|
780
844
|
scope: data[:scope],
|
|
781
845
|
tools: tools
|
|
782
846
|
)
|
|
783
847
|
end
|
|
848
|
+
|
|
849
|
+
def self.parse_config(config)
|
|
850
|
+
return config unless config.is_a?(Hash) && config[:type]
|
|
851
|
+
|
|
852
|
+
case config[:type]
|
|
853
|
+
when 'claudeai-proxy'
|
|
854
|
+
McpClaudeAIProxyServerConfig.new(url: config[:url], id: config[:id])
|
|
855
|
+
when 'sdk'
|
|
856
|
+
McpSdkServerConfigStatus.new(name: config[:name])
|
|
857
|
+
else
|
|
858
|
+
config
|
|
859
|
+
end
|
|
860
|
+
end
|
|
784
861
|
end
|
|
785
862
|
|
|
786
863
|
# Response from get_mcp_status containing all server statuses
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: claude-agent-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Community Contributors
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-03-
|
|
10
|
+
date: 2026-03-12 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: async
|