claude_agent 0.7.7 → 0.7.8
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/SPEC.md +10 -5
- data/lib/claude_agent/client.rb +16 -0
- data/lib/claude_agent/control_protocol.rb +14 -0
- data/lib/claude_agent/hooks.rb +30 -0
- data/lib/claude_agent/version.rb +1 -1
- data/sig/claude_agent.rbs +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9304128d18cec59aa0b0221f199b2674d60a5a2813141562b9df51b88057987
|
|
4
|
+
data.tar.gz: 8bd6696b854f8660e21744bc02d178e3e402a734119554c2869cc4fbb188a75d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ad2321250e0967d302d41d23724fe6f368f3e8fe6cb4461f483f6d13d3b9b35368189cce06dd28f5fa427013a9a272c6a4e1b3e94ee75b8a38dd7ed422c5068
|
|
7
|
+
data.tar.gz: d17257cfcabecbb033ce1427a0237456e5ecbeb0c1c3bedb9bc21dac1336be6a21b96a85ffc96919f7c4774a3f51498a4876f31d11249a05f327966af23f0ae8
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.8] - 2026-02-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `WorktreeCreate` hook event with `WorktreeCreateInput` class (TypeScript SDK v0.2.50 parity)
|
|
14
|
+
- `WorktreeRemove` hook event with `WorktreeRemoveInput` class (TypeScript SDK v0.2.50 parity)
|
|
15
|
+
- `apply_flag_settings` control request on `ControlProtocol` and `Client` for merging settings into the flag layer (TypeScript SDK v0.2.50 parity)
|
|
16
|
+
- RBS signatures for all new types
|
|
17
|
+
|
|
10
18
|
## [0.7.7] - 2026-02-20
|
|
11
19
|
|
|
12
20
|
### 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.
|
|
6
|
+
- TypeScript SDK: v0.2.50 (npm package)
|
|
7
7
|
- Python SDK: v0.1.39 from GitHub (commit 146e3d6)
|
|
8
8
|
- Ruby SDK: This repository
|
|
9
9
|
|
|
10
|
-
**Last Updated:** 2026-02-
|
|
10
|
+
**Last Updated:** 2026-02-22
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -235,6 +235,7 @@ Bidirectional control protocol for SDK-CLI communication.
|
|
|
235
235
|
| `supported_commands` | ✅ | ❌ | ✅ | Get available slash commands |
|
|
236
236
|
| `supported_models` | ✅ | ❌ | ✅ | Get available models |
|
|
237
237
|
| `account_info` | ✅ | ❌ | ✅ | Get account information |
|
|
238
|
+
| `apply_flag_settings` | ✅ | ❌ | ✅ | Merge settings into flag layer |
|
|
238
239
|
|
|
239
240
|
### Return Types
|
|
240
241
|
|
|
@@ -274,6 +275,8 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
274
275
|
| `TeammateIdle` | ✅ | ❌ | ✅ | Teammate idle (v0.2.33) |
|
|
275
276
|
| `TaskCompleted` | ✅ | ❌ | ✅ | Task completed (v0.2.33) |
|
|
276
277
|
| `ConfigChange` | ✅ | ❌ | ✅ | Config file changed (v0.2.49) |
|
|
278
|
+
| `WorktreeCreate` | ✅ | ❌ | ✅ | Worktree creation (v0.2.50) |
|
|
279
|
+
| `WorktreeRemove` | ✅ | ❌ | ✅ | Worktree removal (v0.2.50) |
|
|
277
280
|
|
|
278
281
|
### Hook Input Types
|
|
279
282
|
|
|
@@ -295,6 +298,8 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
295
298
|
| `TeammateIdleHookInput` | ✅ | ❌ | ✅ |
|
|
296
299
|
| `TaskCompletedHookInput` | ✅ | ❌ | ✅ |
|
|
297
300
|
| `ConfigChangeHookInput` | ✅ | ❌ | ✅ |
|
|
301
|
+
| `WorktreeCreateHookInput` | ✅ | ❌ | ✅ |
|
|
302
|
+
| `WorktreeRemoveHookInput` | ✅ | ❌ | ✅ |
|
|
298
303
|
|
|
299
304
|
### Hook Output Types
|
|
300
305
|
|
|
@@ -690,11 +695,12 @@ Public API surface for SDK clients.
|
|
|
690
695
|
- v0.2.45: Added `TaskStartedMessage`, `RateLimitEvent` message types
|
|
691
696
|
- v0.2.47: Added `promptSuggestions` option and `PromptSuggestionMessage`
|
|
692
697
|
- v0.2.49: Added `ConfigChange` hook event, `SandboxFilesystemConfig`
|
|
698
|
+
- v0.2.50: Added `WorktreeCreate`/`WorktreeRemove` hook events, `apply_flag_settings` control request
|
|
693
699
|
|
|
694
700
|
### Python SDK
|
|
695
701
|
- Full source available with `Transport` abstract class
|
|
696
702
|
- Partial control protocol: query and client support interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus
|
|
697
|
-
- Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted, ConfigChange
|
|
703
|
+
- Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted, ConfigChange, WorktreeCreate, WorktreeRemove
|
|
698
704
|
- Missing permission modes: `dontAsk`
|
|
699
705
|
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`, `promptSuggestions`
|
|
700
706
|
- `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`, `description`
|
|
@@ -703,9 +709,8 @@ Public API surface for SDK clients.
|
|
|
703
709
|
- Handles `rate_limit_event` and unknown message types gracefully (v0.1.39)
|
|
704
710
|
|
|
705
711
|
### Ruby SDK (This Repository)
|
|
706
|
-
- Feature parity with TypeScript SDK v0.2.
|
|
712
|
+
- Feature parity with TypeScript SDK v0.2.50
|
|
707
713
|
- Ruby-idiomatic patterns (Data.define, snake_case)
|
|
708
714
|
- Complete control protocol, hook, and V2 Session API support
|
|
709
715
|
- Dedicated Client class for multi-turn conversations
|
|
710
716
|
- `executable`/`executableArgs` marked N/A (JS runtime options)
|
|
711
|
-
- Gaps from TS v0.2.43-v0.2.49: `promptSuggestions`, `TaskStartedMessage`, `RateLimitEvent`, `PromptSuggestionMessage`, `ConfigChange` hook, `SandboxFilesystemConfig`
|
data/lib/claude_agent/client.rb
CHANGED
|
@@ -298,6 +298,22 @@ module ClaudeAgent
|
|
|
298
298
|
@protocol.stop_task(task_id)
|
|
299
299
|
end
|
|
300
300
|
|
|
301
|
+
# Apply flag settings (TypeScript SDK v0.2.50 parity)
|
|
302
|
+
#
|
|
303
|
+
# Merges the provided settings into the flag settings layer.
|
|
304
|
+
#
|
|
305
|
+
# @param settings [Hash] Settings to merge into the flag layer
|
|
306
|
+
# @return [Hash] Response from the CLI
|
|
307
|
+
#
|
|
308
|
+
# @example
|
|
309
|
+
# client.apply_flag_settings({ "model" => "claude-sonnet-4-5-20250514" })
|
|
310
|
+
#
|
|
311
|
+
def apply_flag_settings(settings)
|
|
312
|
+
require_connection!
|
|
313
|
+
|
|
314
|
+
@protocol.apply_flag_settings(settings)
|
|
315
|
+
end
|
|
316
|
+
|
|
301
317
|
# Dynamically set MCP servers for this session (TypeScript SDK parity)
|
|
302
318
|
#
|
|
303
319
|
# This replaces the current set of dynamically-added MCP servers.
|
|
@@ -458,6 +458,20 @@ module ClaudeAgent
|
|
|
458
458
|
send_control_request(subtype: "stop_task", task_id: task_id)
|
|
459
459
|
end
|
|
460
460
|
|
|
461
|
+
# Apply flag settings (TypeScript SDK v0.2.50 parity)
|
|
462
|
+
#
|
|
463
|
+
# Merges the provided settings into the flag settings layer.
|
|
464
|
+
#
|
|
465
|
+
# @param settings [Hash] Settings to merge into the flag layer
|
|
466
|
+
# @return [Hash] Response from the CLI
|
|
467
|
+
#
|
|
468
|
+
# @example
|
|
469
|
+
# protocol.apply_flag_settings({ "model" => "claude-sonnet-4-5-20250514" })
|
|
470
|
+
#
|
|
471
|
+
def apply_flag_settings(settings)
|
|
472
|
+
send_control_request(subtype: "apply_flag_settings", settings: settings)
|
|
473
|
+
end
|
|
474
|
+
|
|
461
475
|
# Dynamically set MCP servers for this session (TypeScript SDK parity)
|
|
462
476
|
#
|
|
463
477
|
# This replaces the current set of dynamically-added MCP servers.
|
data/lib/claude_agent/hooks.rb
CHANGED
|
@@ -19,6 +19,8 @@ module ClaudeAgent
|
|
|
19
19
|
TeammateIdle
|
|
20
20
|
TaskCompleted
|
|
21
21
|
ConfigChange
|
|
22
|
+
WorktreeCreate
|
|
23
|
+
WorktreeRemove
|
|
22
24
|
].freeze
|
|
23
25
|
|
|
24
26
|
# Matcher configuration for hooks
|
|
@@ -304,6 +306,34 @@ module ClaudeAgent
|
|
|
304
306
|
end
|
|
305
307
|
end
|
|
306
308
|
|
|
309
|
+
# Input for WorktreeCreate hook (TypeScript SDK v0.2.50 parity)
|
|
310
|
+
#
|
|
311
|
+
# Fired when a worktree is created.
|
|
312
|
+
#
|
|
313
|
+
class WorktreeCreateInput < BaseHookInput
|
|
314
|
+
attr_reader :name
|
|
315
|
+
|
|
316
|
+
# @param name [String] Worktree name
|
|
317
|
+
def initialize(name:, **kwargs)
|
|
318
|
+
super(hook_event_name: "WorktreeCreate", **kwargs)
|
|
319
|
+
@name = name
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
# Input for WorktreeRemove hook (TypeScript SDK v0.2.50 parity)
|
|
324
|
+
#
|
|
325
|
+
# Fired when a worktree is removed.
|
|
326
|
+
#
|
|
327
|
+
class WorktreeRemoveInput < BaseHookInput
|
|
328
|
+
attr_reader :worktree_path
|
|
329
|
+
|
|
330
|
+
# @param worktree_path [String] Path to the worktree
|
|
331
|
+
def initialize(worktree_path:, **kwargs)
|
|
332
|
+
super(hook_event_name: "WorktreeRemove", **kwargs)
|
|
333
|
+
@worktree_path = worktree_path
|
|
334
|
+
end
|
|
335
|
+
end
|
|
336
|
+
|
|
307
337
|
# Input for TaskCompleted hook (TypeScript SDK v0.2.33 parity)
|
|
308
338
|
#
|
|
309
339
|
# Fired when a task completes.
|
data/lib/claude_agent/version.rb
CHANGED
data/sig/claude_agent.rbs
CHANGED
|
@@ -879,6 +879,18 @@ module ClaudeAgent
|
|
|
879
879
|
def initialize: (source: String, ?file_path: String?, **untyped) -> void
|
|
880
880
|
end
|
|
881
881
|
|
|
882
|
+
class WorktreeCreateInput < BaseHookInput
|
|
883
|
+
attr_reader name: String
|
|
884
|
+
|
|
885
|
+
def initialize: (name: String, **untyped) -> void
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
class WorktreeRemoveInput < BaseHookInput
|
|
889
|
+
attr_reader worktree_path: String
|
|
890
|
+
|
|
891
|
+
def initialize: (worktree_path: String, **untyped) -> void
|
|
892
|
+
end
|
|
893
|
+
|
|
882
894
|
# Permission types
|
|
883
895
|
type permission_result = PermissionResultAllow | PermissionResultDeny
|
|
884
896
|
|
|
@@ -967,6 +979,7 @@ module ClaudeAgent
|
|
|
967
979
|
def mcp_reconnect: (String server_name) -> Hash[String, untyped]
|
|
968
980
|
def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
|
|
969
981
|
def stop_task: (String task_id) -> Hash[String, untyped]
|
|
982
|
+
def apply_flag_settings: (Hash[String, untyped] settings) -> Hash[String, untyped]
|
|
970
983
|
def supported_commands: () -> Array[SlashCommand]
|
|
971
984
|
def supported_models: () -> Array[ModelInfo]
|
|
972
985
|
def mcp_server_status: () -> Array[McpServerStatus]
|
|
@@ -1004,6 +1017,7 @@ module ClaudeAgent
|
|
|
1004
1017
|
def mcp_reconnect: (String server_name) -> Hash[String, untyped]
|
|
1005
1018
|
def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
|
|
1006
1019
|
def stop_task: (String task_id) -> Hash[String, untyped]
|
|
1020
|
+
def apply_flag_settings: (Hash[String, untyped] settings) -> Hash[String, untyped]
|
|
1007
1021
|
def supported_commands: () -> Array[SlashCommand]
|
|
1008
1022
|
def supported_models: () -> Array[ModelInfo]
|
|
1009
1023
|
def mcp_server_status: () -> Array[McpServerStatus]
|