claude_agent 0.7.2 → 0.7.3
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 +10 -0
- data/SPEC.md +23 -18
- data/lib/claude_agent/hooks.rb +40 -0
- data/lib/claude_agent/options.rb +6 -1
- data/lib/claude_agent/version.rb +1 -1
- data/sig/claude_agent.rbs +26 -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: d2d8740456b8efad6aadef1d23c3979de66aac32836f40d87db7f9d5766505fb
|
|
4
|
+
data.tar.gz: aaed4a958504810589552f424094edf52d86732f81780d5525208dab297cb964
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4b3f2d325aad7faa519896e90016a9518ad8285a45dd315936712f0e10548cb2fec0ba77efb191b86aeb265a2bdb43ecb9bb49115efe097092a2fe5a0d250cb
|
|
7
|
+
data.tar.gz: f98723ebf5568c280ac6ea69b767da4d1065760a9eeee1d3ad990191d3553ddbf8deb3ee6cca36a1cd08fe0c8e82125026ec4ba95c158abe36406b8ec173fead
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.3] - 2026-02-06
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `session_id` option for custom conversation UUIDs (`--session-id` CLI flag)
|
|
14
|
+
- `TeammateIdle` hook event with `TeammateIdleInput` (TypeScript SDK v0.2.33 parity)
|
|
15
|
+
- `TaskCompleted` hook event with `TaskCompletedInput` (TypeScript SDK v0.2.33 parity)
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Updated SPEC.md to reflect full TypeScript SDK v0.2.34 parity
|
|
19
|
+
|
|
10
20
|
## [0.7.2] - 2026-02-05
|
|
11
21
|
|
|
12
22
|
### 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.
|
|
7
|
-
- Python SDK: v0.1.
|
|
6
|
+
- TypeScript SDK: v0.2.34 (npm package)
|
|
7
|
+
- Python SDK: v0.1.31 from GitHub (commit 4b19642)
|
|
8
8
|
- Ruby SDK: This repository
|
|
9
9
|
|
|
10
|
-
**Last Updated:** 2026-02-
|
|
10
|
+
**Last Updated:** 2026-02-06
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -50,6 +50,7 @@ Configuration options for SDK queries and clients.
|
|
|
50
50
|
| `maxThinkingTokens` | ✅ | ✅ | ✅ | Max thinking tokens |
|
|
51
51
|
| `continue` | ✅ | ✅ | ✅ | Continue most recent conversation |
|
|
52
52
|
| `resume` | ✅ | ✅ | ✅ | Resume session by ID |
|
|
53
|
+
| `sessionId` | ✅ | ❌ | ✅ | Custom UUID for conversations (v0.2.33) |
|
|
53
54
|
| `resumeSessionAt` | ✅ | ❌ | ✅ | Resume to specific message UUID |
|
|
54
55
|
| `forkSession` | ✅ | ✅ | ✅ | Fork on resume |
|
|
55
56
|
| `persistSession` | ✅ | ❌ | ✅ | Whether to persist to disk |
|
|
@@ -230,15 +231,15 @@ Bidirectional control protocol for SDK-CLI communication.
|
|
|
230
231
|
|
|
231
232
|
### Return Types
|
|
232
233
|
|
|
233
|
-
| Type
|
|
234
|
-
|
|
235
|
-
| `SlashCommand`
|
|
236
|
-
| `ModelInfo`
|
|
237
|
-
| `McpServerStatus`
|
|
238
|
-
| `AccountInfo`
|
|
239
|
-
| `InitializationResult
|
|
240
|
-
| `McpSetServersResult`
|
|
241
|
-
| `RewindFilesResult`
|
|
234
|
+
| Type | TypeScript | Python | Ruby | Notes |
|
|
235
|
+
|------------------------|:----------:|:------:|:----:|------------------------|
|
|
236
|
+
| `SlashCommand` | ✅ | ❌ | ✅ | Available command info |
|
|
237
|
+
| `ModelInfo` | ✅ | ❌ | ✅ | Model information |
|
|
238
|
+
| `McpServerStatus` | ✅ | ❌ | ✅ | MCP server status |
|
|
239
|
+
| `AccountInfo` | ✅ | ❌ | ✅ | Account information |
|
|
240
|
+
| `InitializationResult` | ✅ | ❌ | ✅ | Full init response |
|
|
241
|
+
| `McpSetServersResult` | ✅ | ❌ | ✅ | Set servers result |
|
|
242
|
+
| `RewindFilesResult` | ✅ | ✅ | ✅ | Rewind result |
|
|
242
243
|
|
|
243
244
|
---
|
|
244
245
|
|
|
@@ -263,6 +264,8 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
263
264
|
| `PreCompact` | ✅ | ✅ | ✅ | Before compaction |
|
|
264
265
|
| `PermissionRequest` | ✅ | ✅ | ✅ | Permission requested |
|
|
265
266
|
| `Setup` | ✅ | ❌ | ✅ | Initial setup/maintenance |
|
|
267
|
+
| `TeammateIdle` | ✅ | ❌ | ✅ | Teammate idle (v0.2.33) |
|
|
268
|
+
| `TaskCompleted` | ✅ | ❌ | ✅ | Task completed (v0.2.33) |
|
|
266
269
|
|
|
267
270
|
### Hook Input Types
|
|
268
271
|
|
|
@@ -281,6 +284,8 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
281
284
|
| `PreCompactHookInput` | ✅ | ✅ | ✅ |
|
|
282
285
|
| `PermissionRequestHookInput` | ✅ | ✅ | ✅ |
|
|
283
286
|
| `SetupHookInput` | ✅ | ❌ | ✅ |
|
|
287
|
+
| `TeammateIdleHookInput` | ✅ | ❌ | ✅ |
|
|
288
|
+
| `TaskCompletedHookInput` | ✅ | ❌ | ✅ |
|
|
284
289
|
|
|
285
290
|
### Hook Output Types
|
|
286
291
|
|
|
@@ -668,16 +673,16 @@ Public API surface for SDK clients.
|
|
|
668
673
|
- Full source available
|
|
669
674
|
- Has `Transport` abstract class and several query control methods
|
|
670
675
|
- Query supports: `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `stream_input()`, `close()`, `get_mcp_status()`
|
|
671
|
-
- Client supports: `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `get_mcp_status()`
|
|
672
|
-
- Missing hooks: SessionStart, SessionEnd, Setup
|
|
676
|
+
- Client supports: `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `get_mcp_status()`, `get_server_info()`
|
|
677
|
+
- Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted
|
|
673
678
|
- Missing permission modes: `delegate`, `dontAsk`
|
|
674
|
-
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
|
|
679
|
+
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
|
|
675
680
|
- `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`
|
|
676
|
-
-
|
|
677
|
-
-
|
|
681
|
+
- Has `additionalContext` in `PreToolUseHookSpecificOutput` (added in v0.1.30)
|
|
682
|
+
- Has `create_sdk_mcp_server`, `tool()` helper, and MCP tool annotations (added in v0.1.30/v0.1.31)
|
|
678
683
|
|
|
679
684
|
### Ruby SDK (This Repository)
|
|
680
|
-
- Full TypeScript SDK v0.2.
|
|
685
|
+
- Full TypeScript SDK v0.2.34 feature parity (v0.2.34 contains no new SDK features beyond a Claude Code version bump)
|
|
681
686
|
- Ruby-idiomatic patterns (Data.define, snake_case)
|
|
682
687
|
- Complete control protocol, hook, and V2 Session API support
|
|
683
688
|
- Dedicated Client class for multi-turn conversations
|
data/lib/claude_agent/hooks.rb
CHANGED
|
@@ -16,6 +16,8 @@ module ClaudeAgent
|
|
|
16
16
|
PreCompact
|
|
17
17
|
PermissionRequest
|
|
18
18
|
Setup
|
|
19
|
+
TeammateIdle
|
|
20
|
+
TaskCompleted
|
|
19
21
|
].freeze
|
|
20
22
|
|
|
21
23
|
# Matcher configuration for hooks
|
|
@@ -259,4 +261,42 @@ module ClaudeAgent
|
|
|
259
261
|
trigger == "maintenance"
|
|
260
262
|
end
|
|
261
263
|
end
|
|
264
|
+
|
|
265
|
+
# Input for TeammateIdle hook (TypeScript SDK v0.2.33 parity)
|
|
266
|
+
#
|
|
267
|
+
# Fired when a teammate becomes idle.
|
|
268
|
+
#
|
|
269
|
+
class TeammateIdleInput < BaseHookInput
|
|
270
|
+
attr_reader :teammate_name, :team_name
|
|
271
|
+
|
|
272
|
+
# @param teammate_name [String] Name of the idle teammate
|
|
273
|
+
# @param team_name [String] Name of the team
|
|
274
|
+
def initialize(teammate_name:, team_name:, **kwargs)
|
|
275
|
+
super(hook_event_name: "TeammateIdle", **kwargs)
|
|
276
|
+
@teammate_name = teammate_name
|
|
277
|
+
@team_name = team_name
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Input for TaskCompleted hook (TypeScript SDK v0.2.33 parity)
|
|
282
|
+
#
|
|
283
|
+
# Fired when a task completes.
|
|
284
|
+
#
|
|
285
|
+
class TaskCompletedInput < BaseHookInput
|
|
286
|
+
attr_reader :task_id, :task_subject, :task_description, :teammate_name, :team_name
|
|
287
|
+
|
|
288
|
+
# @param task_id [String] ID of the completed task
|
|
289
|
+
# @param task_subject [String] Subject of the completed task
|
|
290
|
+
# @param task_description [String, nil] Description of the completed task
|
|
291
|
+
# @param teammate_name [String, nil] Name of the teammate that completed the task
|
|
292
|
+
# @param team_name [String, nil] Name of the team
|
|
293
|
+
def initialize(task_id:, task_subject:, task_description: nil, teammate_name: nil, team_name: nil, **kwargs)
|
|
294
|
+
super(hook_event_name: "TaskCompleted", **kwargs)
|
|
295
|
+
@task_id = task_id
|
|
296
|
+
@task_subject = task_subject
|
|
297
|
+
@task_description = task_description
|
|
298
|
+
@teammate_name = teammate_name
|
|
299
|
+
@team_name = team_name
|
|
300
|
+
end
|
|
301
|
+
end
|
|
262
302
|
end
|
data/lib/claude_agent/options.rb
CHANGED
|
@@ -52,7 +52,7 @@ module ClaudeAgent
|
|
|
52
52
|
system_prompt append_system_prompt
|
|
53
53
|
model fallback_model
|
|
54
54
|
permission_mode permission_prompt_tool_name can_use_tool allow_dangerously_skip_permissions
|
|
55
|
-
continue_conversation resume fork_session resume_session_at
|
|
55
|
+
continue_conversation resume fork_session resume_session_at session_id
|
|
56
56
|
max_turns max_budget_usd max_thinking_tokens
|
|
57
57
|
strict_mcp_config mcp_servers hooks
|
|
58
58
|
settings sandbox cwd add_dirs env user agent
|
|
@@ -179,6 +179,7 @@ module ClaudeAgent
|
|
|
179
179
|
args.push("--resume", resume) if resume
|
|
180
180
|
args.push("--fork-session") if fork_session
|
|
181
181
|
args.push("--resume-session-at", resume_session_at) if resume_session_at
|
|
182
|
+
args.push("--session-id", session_id) if session_id
|
|
182
183
|
end
|
|
183
184
|
end
|
|
184
185
|
|
|
@@ -287,6 +288,10 @@ module ClaudeAgent
|
|
|
287
288
|
raise ConfigurationError, "max_budget_usd must be a positive number"
|
|
288
289
|
end
|
|
289
290
|
|
|
291
|
+
if session_id && (continue_conversation || resume) && !fork_session
|
|
292
|
+
raise ConfigurationError, "session_id cannot be used with continue or resume unless fork_session is also set"
|
|
293
|
+
end
|
|
294
|
+
|
|
290
295
|
setup_options = [ init, init_only, maintenance ].count { |opt| opt }
|
|
291
296
|
if setup_options > 1
|
|
292
297
|
raise ConfigurationError, "Only one of init, init_only, or maintenance can be set at a time"
|
data/lib/claude_agent/version.rb
CHANGED
data/sig/claude_agent.rbs
CHANGED
|
@@ -265,6 +265,7 @@ module ClaudeAgent
|
|
|
265
265
|
attr_accessor resume: String?
|
|
266
266
|
attr_accessor fork_session: bool
|
|
267
267
|
attr_accessor resume_session_at: String?
|
|
268
|
+
attr_accessor session_id: String?
|
|
268
269
|
attr_accessor persist_session: bool
|
|
269
270
|
|
|
270
271
|
# Limits & budget
|
|
@@ -768,6 +769,31 @@ module ClaudeAgent
|
|
|
768
769
|
def initialize: (tool_name: String, tool_input: Hash[String, untyped], ?permission_suggestions: untyped, **untyped) -> void
|
|
769
770
|
end
|
|
770
771
|
|
|
772
|
+
class SetupInput < BaseHookInput
|
|
773
|
+
attr_reader trigger: String
|
|
774
|
+
|
|
775
|
+
def initialize: (trigger: String, **untyped) -> void
|
|
776
|
+
def init?: () -> bool
|
|
777
|
+
def maintenance?: () -> bool
|
|
778
|
+
end
|
|
779
|
+
|
|
780
|
+
class TeammateIdleInput < BaseHookInput
|
|
781
|
+
attr_reader teammate_name: String
|
|
782
|
+
attr_reader team_name: String
|
|
783
|
+
|
|
784
|
+
def initialize: (teammate_name: String, team_name: String, **untyped) -> void
|
|
785
|
+
end
|
|
786
|
+
|
|
787
|
+
class TaskCompletedInput < BaseHookInput
|
|
788
|
+
attr_reader task_id: String
|
|
789
|
+
attr_reader task_subject: String
|
|
790
|
+
attr_reader task_description: String?
|
|
791
|
+
attr_reader teammate_name: String?
|
|
792
|
+
attr_reader team_name: String?
|
|
793
|
+
|
|
794
|
+
def initialize: (task_id: String, task_subject: String, ?task_description: String?, ?teammate_name: String?, ?team_name: String?, **untyped) -> void
|
|
795
|
+
end
|
|
796
|
+
|
|
771
797
|
# Permission types
|
|
772
798
|
type permission_result = PermissionResultAllow | PermissionResultDeny
|
|
773
799
|
|