claude_agent 0.5.0 → 0.6.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: 47641ba77d22b8a0f150ddad47d58593e05027355f278d233fa3905e9463ff0b
4
- data.tar.gz: 8615b423941943ec78c76100e4acbf313f2f038033fe1dd21ff85df3ffbd7a11
3
+ metadata.gz: 4d11f6fa8fa6ecc4b00e0bb6f7913582d0ac8675f649f2d5b423306660a44247
4
+ data.tar.gz: 1c7259588ea2b823ad06c7f263830418a590b5488c7db3d9d825b3e46b31495a
5
5
  SHA512:
6
- metadata.gz: f683a79341de2cfd99db5a287562bc93d4cb9c8c46c1378e997d5c1ef6eff55d5aeed4596d74388d62bb6235484f7ddb9ffc75ff967fa6e716da971293fc64f0
7
- data.tar.gz: 0dca9c4ce8ea188c9dbab54637c03ce9f291dfb7b60a81594f2098acf64253609e9a3150c1397a16cdb2e7f255d67f753409f6676cf17803a5b081813b73e8e5
6
+ metadata.gz: e57643b8293c0cba79fb96322daa1c8fd08a068664f63bad5a6787f9731e60232ff0ee806698ff79707c4a000dd600bfc1e459ea9a0933e7685e5b5fefd87911
7
+ data.tar.gz: 6ac435262b2489ef696db91db6440e8df9f8000e09a46b97cc80decdda1b04cedfcd561a6d56e8b09aa8d373fa223f1ecdad2ff08f82ba9ea350375dd5772eed
data/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.6.0] - 2026-01-30
11
+
12
+ ### Added
13
+ - `FilesPersistedEvent` message type for file persistence confirmation (TypeScript SDK v0.2.25 parity)
14
+ - `claudeai-proxy` MCP server type support via Hash-based config passthrough
15
+
16
+ ### Changed
17
+ - Updated SPEC.md to reference TypeScript SDK v0.2.25 and Python SDK v0.1.25
18
+
10
19
  ## [0.5.0] - 2026-01-25
11
20
 
12
21
  ### 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.19 (npm package)
7
- - Python SDK: v0.1.22 from GitHub (commit 6a0140a)
6
+ - TypeScript SDK: v0.2.25 (npm package)
7
+ - Python SDK: v0.1.25 from GitHub (commit 1bf665c)
8
8
  - Ruby SDK: This repository
9
9
 
10
- **Last Updated:** 2025-01-25
10
+ **Last Updated:** 2026-01-30
11
11
 
12
12
  ---
13
13
 
@@ -65,7 +65,7 @@ Configuration options for SDK queries and clients.
65
65
  | `additionalDirectories` | ✅ | ✅ | ✅ | Extra allowed directories |
66
66
  | `env` | ✅ | ✅ | ✅ | Environment variables |
67
67
  | `sandbox` | ✅ | ✅ | ✅ | Sandbox settings |
68
- | `settings` | ✅ | | ✅ | Settings file path or JSON string (e.g., plansDirectory) |
68
+ | `settings` | ✅ | | ✅ | Settings file path or JSON string (e.g., plansDirectory) |
69
69
  | `settingSources` | ✅ | ✅ | ✅ | Which settings to load |
70
70
  | `plugins` | ✅ | ✅ | ✅ | Plugin configurations |
71
71
  | `betas` | ✅ | ✅ | ✅ | Beta features (e.g., context-1m-2025-08-07) |
@@ -104,6 +104,7 @@ Messages exchanged between SDK and CLI.
104
104
  | `AuthStatusMessage` | ✅ | ❌ | ✅ | Authentication status |
105
105
  | `TaskNotificationMessage` | ✅ | ❌ | ✅ | Background task completion |
106
106
  | `ToolUseSummaryMessage` | ✅ | ❌ | ✅ | Summary of tool use (collapsed) |
107
+ | `FilesPersistedEvent` | ✅ | ❌ | ✅ | File persistence confirmation |
107
108
 
108
109
  ### Message Fields
109
110
 
@@ -212,12 +213,12 @@ Bidirectional control protocol for SDK-CLI communication.
212
213
  | `can_use_tool` | ✅ | ✅ | ✅ | Permission callback |
213
214
  | `hook_callback` | ✅ | ✅ | ✅ | Execute hook callback |
214
215
  | `set_permission_mode` | ✅ | ✅ | ✅ | Change permission mode |
215
- | `set_model` | ✅ | | ✅ | Change model |
216
+ | `set_model` | ✅ | | ✅ | Change model |
216
217
  | `set_max_thinking_tokens` | ✅ | ❌ | ✅ | Change thinking tokens limit |
217
218
  | `rewind_files` | ✅ | ✅ | ✅ | Rewind file checkpoints |
218
219
  | `mcp_message` | ✅ | ✅ | ✅ | Route MCP message |
219
220
  | `mcp_set_servers` | ✅ | ❌ | ✅ | Dynamically set MCP servers |
220
- | `mcp_status` | ✅ | | ✅ | Get MCP server status |
221
+ | `mcp_status` | ✅ | | ✅ | Get MCP server status |
221
222
  | `mcp_reconnect` | ✅ | ❌ | ✅ | Reconnect to MCP server |
222
223
  | `mcp_toggle` | ✅ | ❌ | ✅ | Enable/disable MCP server |
223
224
  | `supported_commands` | ✅ | ❌ | ✅ | Get available slash commands |
@@ -247,7 +248,7 @@ Event hooks for intercepting and modifying SDK behavior.
247
248
  |----------------------|:----------:|:------:|:----:|---------------------------|
248
249
  | `PreToolUse` | ✅ | ✅ | ✅ | Before tool execution |
249
250
  | `PostToolUse` | ✅ | ✅ | ✅ | After tool execution |
250
- | `PostToolUseFailure` | ✅ | | ✅ | After tool failure |
251
+ | `PostToolUseFailure` | ✅ | | ✅ | After tool failure |
251
252
  | `Notification` | ✅ | ❌ | ✅ | System notifications |
252
253
  | `UserPromptSubmit` | ✅ | ✅ | ✅ | User message submitted |
253
254
  | `SessionStart` | ✅ | ❌ | ✅ | Session starts |
@@ -265,7 +266,7 @@ Event hooks for intercepting and modifying SDK behavior.
265
266
  |-------------------------------|:----------:|:------:|:----:|
266
267
  | `PreToolUseHookInput` | ✅ | ✅ | ✅ |
267
268
  | `PostToolUseHookInput` | ✅ | ✅ | ✅ |
268
- | `PostToolUseFailureHookInput` | ✅ | | ✅ |
269
+ | `PostToolUseFailureHookInput` | ✅ | | ✅ |
269
270
  | `NotificationHookInput` | ✅ | ❌ | ✅ |
270
271
  | `UserPromptSubmitHookInput` | ✅ | ✅ | ✅ |
271
272
  | `SessionStartHookInput` | ✅ | ❌ | ✅ |
@@ -300,7 +301,7 @@ Event-specific fields returned via `hookSpecificOutput`:
300
301
  | Field | TypeScript | Python | Ruby | Notes |
301
302
  |----------------------------|:----------:|:------:|:----:|------------------------------------|
302
303
  | `permissionDecision` | ✅ | ✅ | ✅ | `allow`, `deny`, or `ask` |
303
- | `permissionDecisionReason` | ✅ | | ✅ | Reason for permission decision |
304
+ | `permissionDecisionReason` | ✅ | | ✅ | Reason for permission decision |
304
305
  | `updatedInput` | ✅ | ✅ | ✅ | Modified tool input |
305
306
  | `additionalContext` | ✅ | ❌ | ✅ | Context string returned to model |
306
307
 
@@ -315,7 +316,7 @@ Event-specific fields returned via `hookSpecificOutput`:
315
316
 
316
317
  | Field | TypeScript | Python | Ruby | Notes |
317
318
  |---------------------|:----------:|:------:|:----:|----------------------------------|
318
- | `additionalContext` | ✅ | | ✅ | Context string returned to model |
319
+ | `additionalContext` | ✅ | | ✅ | Context string returned to model |
319
320
 
320
321
  #### SessionStartHookSpecificOutput
321
322
 
@@ -436,12 +437,13 @@ Model Context Protocol server support.
436
437
 
437
438
  ### MCP Server Types
438
439
 
439
- | Type | TypeScript | Python | Ruby | Notes |
440
- |---------|:----------:|:------:|:----:|-----------------------|
441
- | `stdio` | ✅ | ✅ | ✅ | Subprocess with stdio |
442
- | `sse` | ✅ | ✅ | ✅ | Server-sent events |
443
- | `http` | ✅ | ✅ | ✅ | HTTP transport |
444
- | `sdk` | ✅ | ✅ | ✅ | In-process SDK server |
440
+ | Type | TypeScript | Python | Ruby | Notes |
441
+ |------------------|:----------:|:------:|:----:|----------------------------------|
442
+ | `stdio` | ✅ | ✅ | ✅ | Subprocess with stdio |
443
+ | `sse` | ✅ | ✅ | ✅ | Server-sent events |
444
+ | `http` | ✅ | ✅ | ✅ | HTTP transport |
445
+ | `sdk` | ✅ | ✅ | ✅ | In-process SDK server |
446
+ | `claudeai-proxy` | ✅ | ❌ | ✅ | Claude.ai proxy server (managed) |
445
447
 
446
448
  ### MCP Server Config Fields
447
449
 
@@ -595,41 +597,41 @@ Public API surface for SDK clients.
595
597
  | One-shot query function | ✅ `query()` | ✅ `query()` | ✅ `ClaudeAgent.query()` | Simple prompts |
596
598
  | Returns async generator | ✅ | ✅ | ✅ (Enumerator) | Streaming messages |
597
599
 
598
- ### Query Control Methods (TypeScript)
600
+ ### Query Control Methods
599
601
 
600
602
  | Method | TypeScript | Python | Ruby | Notes |
601
603
  |--------------------------|:----------:|:------:|:----:|------------------------|
602
- | `interrupt()` | ✅ | | ✅ | Interrupt execution |
603
- | `setPermissionMode()` | ✅ | | ✅ | Change permission mode |
604
- | `setModel()` | ✅ | | ✅ | Change model |
604
+ | `interrupt()` | ✅ | | ✅ | Interrupt execution |
605
+ | `setPermissionMode()` | ✅ | | ✅ | Change permission mode |
606
+ | `setModel()` | ✅ | | ✅ | Change model |
605
607
  | `setMaxThinkingTokens()` | ✅ | ❌ | ✅ | Set thinking limit |
606
608
  | `supportedCommands()` | ✅ | ❌ | ✅ | Get slash commands |
607
609
  | `supportedModels()` | ✅ | ❌ | ✅ | Get available models |
608
- | `mcpServerStatus()` | ✅ | | ✅ | Get MCP status |
610
+ | `mcpServerStatus()` | ✅ | | ✅ | Get MCP status |
609
611
  | `accountInfo()` | ✅ | ❌ | ✅ | Get account info |
610
612
  | `rewindFiles()` | ✅ | ✅ | ✅ | Rewind file changes |
611
613
  | `setMcpServers()` | ✅ | ❌ | ✅ | Dynamic MCP servers |
612
- | `streamInput()` | ✅ | | ✅ | Stream user input |
613
- | `close()` | ✅ | | ✅ | Close query/session |
614
+ | `streamInput()` | ✅ | | ✅ | Stream user input |
615
+ | `close()` | ✅ | | ✅ | Close query/session |
614
616
 
615
617
  ### Client Class
616
618
 
617
- | Feature | TypeScript | Python | Ruby | Notes |
618
- |----------------------|:----------:|:-------------------:|:-----------------------:|--------------------------------|
619
- | Multi-turn client | ❌ | ✅ `ClaudeSDKClient` | ✅ `ClaudeAgent::Client` | Interactive sessions |
620
- | `connect()` | N/A | ✅ | ✅ | Start session |
621
- | `disconnect()` | N/A | ✅ | ✅ | End session |
622
- | `send_message()` | N/A | ✅ | ✅ | Send user message |
623
- | `receive_response()` | N/A | ✅ | ✅ | Receive until result |
624
- | `stream_input()` | N/A | ❌ | ✅ | Stream input messages |
625
- | `abort!()` | N/A | ❌ | ✅ | Abort operations |
626
- | Control methods | N/A | Partial | ✅ | All TypeScript control methods |
619
+ | Feature | TypeScript | Python | Ruby | Notes |
620
+ |----------------------|:----------:|:-------------------:|:-----------------------:|----------------------------------------------------------------------------------|
621
+ | Multi-turn client | ❌ | ✅ `ClaudeSDKClient` | ✅ `ClaudeAgent::Client` | Interactive sessions |
622
+ | `connect()` | N/A | ✅ | ✅ | Start session |
623
+ | `disconnect()` | N/A | ✅ | ✅ | End session |
624
+ | `send_message()` | N/A | ✅ | ✅ | Send user message |
625
+ | `receive_response()` | N/A | ✅ | ✅ | Receive until result |
626
+ | `stream_input()` | N/A | ❌ | ✅ | Stream input messages |
627
+ | `abort!()` | N/A | ❌ | ✅ | Abort operations |
628
+ | Control methods | N/A | Partial | ✅ | interrupt, setPermissionMode, setModel, rewindFiles (Python); all methods (Ruby) |
627
629
 
628
630
  ### Transport
629
631
 
630
632
  | Feature | TypeScript | Python | Ruby | Notes |
631
633
  |-----------------------|:----------:|:------:|:----:|--------------------------|
632
- | `Transport` interface | ✅ | | ✅ | Transport abstraction |
634
+ | `Transport` interface | ✅ | | ✅ | Transport abstraction |
633
635
  | Process transport | ✅ | ✅ | ✅ | Subprocess communication |
634
636
  | Custom spawn | ✅ | ❌ | ✅ | VM/container support |
635
637
 
@@ -659,21 +661,32 @@ Public API surface for SDK clients.
659
661
  - v0.2.12+ adds `user` option to SDKSessionOptions
660
662
  - v0.2.19 adds `mcp_reconnect` and `mcp_toggle` control requests
661
663
  - v0.2.19 adds `HookStartedMessage`, `HookProgressMessage`, and `ToolUseSummaryMessage`
664
+ - v0.2.25 adds `SDKFilesPersistedEvent` message type for file persistence confirmation
665
+ - v0.2.25 adds `McpClaudeAIProxyServerConfig` (`claudeai-proxy` type) for managed proxy servers
662
666
 
663
667
  ### Python SDK
664
- - Full source available (v0.1.22)
665
- - Fewer control protocol features than TypeScript
666
- - Does not support SessionStart/SessionEnd/Notification hooks due to setup limitations
668
+ - Full source available (v0.1.25)
669
+ - Now has `Transport` abstract class and several query control methods
670
+ - Supports `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `stream_input()`, `close()`, `get_mcp_status()` in query
671
+ - Client also supports `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`
672
+ - Does not support SessionStart/SessionEnd/Notification/SubagentStart/PermissionRequest/Setup hooks
667
673
  - Missing several permission modes (delegate, dontAsk)
674
+ - Missing `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `strictMcpConfig`
675
+ - Missing `init`/`initOnly`/`maintenance` Setup hook options
668
676
  - `excludedCommands` in sandbox now supported
669
- - `tool_use_id` now included in PreToolUseHookInput
670
- - `additionalContext` now supported in UserPromptSubmitHookSpecificOutput
677
+ - v0.1.25 adds `PostToolUseFailure` hook event support
678
+ - v0.1.25 adds `permissionDecisionReason` to `PreToolUseHookSpecificOutput`
679
+ - `additionalContext` supported in `UserPromptSubmitHookSpecificOutput`
680
+ - `PreToolUseHookInput` does not include `tool_use_id` (unlike TypeScript)
681
+ - `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`
671
682
 
672
683
  ### Ruby SDK (This Repository)
673
- - Complete TypeScript SDK feature parity
684
+ - Full TypeScript SDK feature parity
674
685
  - Ruby-idiomatic patterns (Data.define, snake_case)
675
686
  - Complete control protocol support
676
687
  - Dedicated Client class for multi-turn conversations
677
688
  - Full hook event support including all 13 events
678
689
  - Full V2 Session API support (unstable)
679
690
  - `executable`/`executableArgs` marked N/A (JS runtime options not applicable to Ruby)
691
+ - Added: `FilesPersistedEvent` message type (new in TS v0.2.25)
692
+ - `claudeai-proxy` MCP server type handled transparently via Hash-based config passthrough (new in TS v0.2.25)
@@ -11,7 +11,7 @@ module ClaudeAgent
11
11
  # Parse a raw message hash into a typed message object
12
12
  #
13
13
  # @param raw [Hash] Raw message from CLI
14
- # @return [UserMessage, UserMessageReplay, AssistantMessage, SystemMessage, ResultMessage, StreamEvent, CompactBoundaryMessage, StatusMessage, ToolProgressMessage, HookResponseMessage, AuthStatusMessage, TaskNotificationMessage, HookStartedMessage, HookProgressMessage, ToolUseSummaryMessage]
14
+ # @return [UserMessage, UserMessageReplay, AssistantMessage, SystemMessage, ResultMessage, StreamEvent, CompactBoundaryMessage, StatusMessage, ToolProgressMessage, HookResponseMessage, AuthStatusMessage, TaskNotificationMessage, HookStartedMessage, HookProgressMessage, ToolUseSummaryMessage, FilesPersistedEvent]
15
15
  # @raise [MessageParseError] If message cannot be parsed
16
16
  def parse(raw)
17
17
  type = raw["type"]
@@ -36,6 +36,8 @@ module ClaudeAgent
36
36
  parse_hook_started_message(raw)
37
37
  when "hook_progress"
38
38
  parse_hook_progress_message(raw)
39
+ when "files_persisted"
40
+ parse_files_persisted_event(raw)
39
41
  else
40
42
  parse_system_message(raw)
41
43
  end
@@ -312,5 +314,15 @@ module ClaudeAgent
312
314
  preceding_tool_use_ids: fetch_dual(raw, :preceding_tool_use_ids, [])
313
315
  )
314
316
  end
317
+
318
+ def parse_files_persisted_event(raw)
319
+ FilesPersistedEvent.new(
320
+ uuid: raw["uuid"] || "",
321
+ session_id: fetch_dual(raw, :session_id, ""),
322
+ files: raw["files"] || [],
323
+ failed: raw["failed"] || [],
324
+ processed_at: fetch_dual(raw, :processed_at)
325
+ )
326
+ end
315
327
  end
316
328
  end
@@ -614,6 +614,43 @@ module ClaudeAgent
614
614
  end
615
615
  end
616
616
 
617
+ # Files persisted event (TypeScript SDK v0.2.25 parity)
618
+ #
619
+ # Sent when files are persisted to storage during a session.
620
+ # Contains lists of successfully persisted files and any failures.
621
+ #
622
+ # @example
623
+ # msg = FilesPersistedEvent.new(
624
+ # uuid: "msg-123",
625
+ # session_id: "session-abc",
626
+ # files: [{ "filename" => "test.rb", "file_id" => "file-456" }],
627
+ # failed: [],
628
+ # processed_at: "2026-01-30T12:00:00Z"
629
+ # )
630
+ # msg.files.first["filename"] # => "test.rb"
631
+ #
632
+ FilesPersistedEvent = Data.define(
633
+ :uuid,
634
+ :session_id,
635
+ :files,
636
+ :failed,
637
+ :processed_at
638
+ ) do
639
+ def initialize(
640
+ uuid:,
641
+ session_id:,
642
+ files: [],
643
+ failed: [],
644
+ processed_at: nil
645
+ )
646
+ super
647
+ end
648
+
649
+ def type
650
+ :files_persisted
651
+ end
652
+ end
653
+
617
654
  # All message types
618
655
  MESSAGE_TYPES = [
619
656
  UserMessage,
@@ -630,6 +667,7 @@ module ClaudeAgent
630
667
  TaskNotificationMessage,
631
668
  HookStartedMessage,
632
669
  HookProgressMessage,
633
- ToolUseSummaryMessage
670
+ ToolUseSummaryMessage,
671
+ FilesPersistedEvent
634
672
  ].freeze
635
673
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgent
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
data/sig/claude_agent.rbs CHANGED
@@ -393,7 +393,7 @@ module ClaudeAgent
393
393
  CONTENT_BLOCK_TYPES: Array[Class]
394
394
 
395
395
  # Message types
396
- type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage
396
+ type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent
397
397
 
398
398
  MESSAGE_TYPES: Array[Class]
399
399
 
@@ -616,6 +616,18 @@ module ClaudeAgent
616
616
  def type: () -> :tool_use_summary
617
617
  end
618
618
 
619
+ # Files persisted event (TypeScript SDK v0.2.25 parity)
620
+ class FilesPersistedEvent
621
+ attr_reader uuid: String
622
+ attr_reader session_id: String
623
+ attr_reader files: Array[Hash[String, String]]
624
+ attr_reader failed: Array[Hash[String, String]]
625
+ attr_reader processed_at: String?
626
+
627
+ def initialize: (uuid: String, session_id: String, ?files: Array[Hash[String, String]], ?failed: Array[Hash[String, String]], ?processed_at: String?) -> void
628
+ def type: () -> :files_persisted
629
+ end
630
+
619
631
  # Message parser
620
632
  class MessageParser
621
633
  def initialize: () -> void
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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Carr