claude_agent 0.7.0 → 0.7.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 +4 -4
- data/CHANGELOG.md +2 -0
- data/SPEC.md +23 -45
- data/lib/claude_agent/message_parser.rb +2 -1
- data/lib/claude_agent/messages.rb +4 -2
- data/lib/claude_agent/options.rb +12 -1
- data/lib/claude_agent/version.rb +1 -1
- data/sig/claude_agent.rbs +5 -1
- 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: db922e35ad5e88546f17fe9d51a42d05ea0dbe5ae5b13f0f9733857b5bc467b2
|
|
4
|
+
data.tar.gz: 55b2aceec109d36a624fb0c2fa1979b440f05758e01b894f962b5c27c02bfdb9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1163853d431c1203309bb1926204034c9a77ab581deb52f3400cb266751a18a308be66342e8a31f7d2eae1a30767f68fb0255df35844097d733e34397345e56a
|
|
7
|
+
data.tar.gz: 8c99d3eb98b28a31abfd704e800fc8df816132037d8c30329a2f575a88b2debe02afd3dde48842edfcd78235268484e638119209712e9a82dccde725b0f908a4
|
data/CHANGELOG.md
CHANGED
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.31 (npm package)
|
|
7
|
+
- Python SDK: v0.1.29 from GitHub (commit 7519c96)
|
|
8
8
|
- Ruby SDK: This repository
|
|
9
9
|
|
|
10
|
-
**Last Updated:** 2026-
|
|
10
|
+
**Last Updated:** 2026-02-03
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -80,6 +80,8 @@ Configuration options for SDK queries and clients.
|
|
|
80
80
|
| `init` | ✅ | ❌ | ✅ | Run Setup hooks (init trigger), then continue (hidden CLI) |
|
|
81
81
|
| `initOnly` | ✅ | ❌ | ✅ | Run Setup hooks (init trigger), then exit (hidden CLI) |
|
|
82
82
|
| `maintenance` | ✅ | ❌ | ✅ | Run Setup hooks (maintenance trigger), continue (hidden CLI) |
|
|
83
|
+
| `debug` | ✅ | ❌ | ✅ | Enable verbose debug logging |
|
|
84
|
+
| `debugFile` | ✅ | ❌ | ✅ | Write debug logs to specific file path |
|
|
83
85
|
|
|
84
86
|
---
|
|
85
87
|
|
|
@@ -126,6 +128,7 @@ Messages exchanged between SDK and CLI.
|
|
|
126
128
|
| `errors` | ✅ | ❌ | ✅ | Error messages |
|
|
127
129
|
| `uuid` | ✅ | ❌ | ✅ | Message UUID |
|
|
128
130
|
| `session_id` | ✅ | ✅ | ✅ | Session ID |
|
|
131
|
+
| `stop_reason` | ✅ | ❌ | ✅ | Why model stopped |
|
|
129
132
|
|
|
130
133
|
#### Result Subtypes
|
|
131
134
|
|
|
@@ -249,15 +252,15 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
249
252
|
| `PreToolUse` | ✅ | ✅ | ✅ | Before tool execution |
|
|
250
253
|
| `PostToolUse` | ✅ | ✅ | ✅ | After tool execution |
|
|
251
254
|
| `PostToolUseFailure` | ✅ | ✅ | ✅ | After tool failure |
|
|
252
|
-
| `Notification` | ✅ |
|
|
255
|
+
| `Notification` | ✅ | ✅ | ✅ | System notifications |
|
|
253
256
|
| `UserPromptSubmit` | ✅ | ✅ | ✅ | User message submitted |
|
|
254
257
|
| `SessionStart` | ✅ | ❌ | ✅ | Session starts |
|
|
255
258
|
| `SessionEnd` | ✅ | ❌ | ✅ | Session ends |
|
|
256
259
|
| `Stop` | ✅ | ✅ | ✅ | Agent stops |
|
|
257
|
-
| `SubagentStart` | ✅ |
|
|
260
|
+
| `SubagentStart` | ✅ | ✅ | ✅ | Subagent starts |
|
|
258
261
|
| `SubagentStop` | ✅ | ✅ | ✅ | Subagent stops |
|
|
259
262
|
| `PreCompact` | ✅ | ✅ | ✅ | Before compaction |
|
|
260
|
-
| `PermissionRequest` | ✅ |
|
|
263
|
+
| `PermissionRequest` | ✅ | ✅ | ✅ | Permission requested |
|
|
261
264
|
| `Setup` | ✅ | ❌ | ✅ | Initial setup/maintenance |
|
|
262
265
|
|
|
263
266
|
### Hook Input Types
|
|
@@ -267,15 +270,15 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
267
270
|
| `PreToolUseHookInput` | ✅ | ✅ | ✅ |
|
|
268
271
|
| `PostToolUseHookInput` | ✅ | ✅ | ✅ |
|
|
269
272
|
| `PostToolUseFailureHookInput` | ✅ | ✅ | ✅ |
|
|
270
|
-
| `NotificationHookInput` | ✅ |
|
|
273
|
+
| `NotificationHookInput` | ✅ | ✅ | ✅ |
|
|
271
274
|
| `UserPromptSubmitHookInput` | ✅ | ✅ | ✅ |
|
|
272
275
|
| `SessionStartHookInput` | ✅ | ❌ | ✅ |
|
|
273
276
|
| `SessionEndHookInput` | ✅ | ❌ | ✅ |
|
|
274
277
|
| `StopHookInput` | ✅ | ✅ | ✅ |
|
|
275
|
-
| `SubagentStartHookInput` | ✅ |
|
|
278
|
+
| `SubagentStartHookInput` | ✅ | ✅ | ✅ |
|
|
276
279
|
| `SubagentStopHookInput` | ✅ | ✅ | ✅ |
|
|
277
280
|
| `PreCompactHookInput` | ✅ | ✅ | ✅ |
|
|
278
|
-
| `PermissionRequestHookInput` | ✅ |
|
|
281
|
+
| `PermissionRequestHookInput` | ✅ | ✅ | ✅ |
|
|
279
282
|
| `SetupHookInput` | ✅ | ❌ | ✅ |
|
|
280
283
|
|
|
281
284
|
### Hook Output Types
|
|
@@ -655,46 +658,21 @@ Public API surface for SDK clients.
|
|
|
655
658
|
- Primary reference for API surface (most comprehensive)
|
|
656
659
|
- Source is bundled/minified, but `sdk.d.ts` provides complete type definitions
|
|
657
660
|
- Includes unstable V2 session API
|
|
658
|
-
-
|
|
659
|
-
- Includes experimental `criticalSystemReminder_EXPERIMENTAL` for agent definitions
|
|
660
|
-
- `SessionStartHookInput` includes `model` field
|
|
661
|
-
- v0.2.12+ adds `Setup` hook event for init/maintenance
|
|
662
|
-
- v0.2.12+ adds `skills` and `maxTurns` to AgentDefinition
|
|
663
|
-
- v0.2.12+ adds `TaskNotificationMessage` for background task completion
|
|
664
|
-
- v0.2.12+ adds `user` option to SDKSessionOptions
|
|
665
|
-
- v0.2.19 adds `mcp_reconnect` and `mcp_toggle` control requests
|
|
666
|
-
- v0.2.19 adds `HookStartedMessage`, `HookProgressMessage`, and `ToolUseSummaryMessage`
|
|
667
|
-
- v0.2.25 adds `SDKFilesPersistedEvent` message type for file persistence confirmation
|
|
668
|
-
- v0.2.25 adds `McpClaudeAIProxyServerConfig` (`claudeai-proxy` type) for managed proxy servers
|
|
669
|
-
- v0.2.21 adds `reconnectMcpServer()` and `toggleMcpServer()` query methods
|
|
670
|
-
- v0.2.21 adds `config`, `scope`, `tools` fields and `disabled` status to `McpServerStatus`
|
|
671
|
-
- v0.2.27 adds optional `annotations` support to `tool()` helper for MCP tool hints
|
|
661
|
+
- `executable`/`executableArgs` are JS-specific (`node`/`bun`/`deno`)
|
|
672
662
|
|
|
673
663
|
### Python SDK
|
|
674
|
-
- Full source available
|
|
675
|
-
-
|
|
676
|
-
-
|
|
677
|
-
- Client
|
|
678
|
-
-
|
|
679
|
-
- Missing
|
|
680
|
-
- Missing `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `strictMcpConfig`
|
|
681
|
-
- Missing `init`/`initOnly`/`maintenance` Setup hook options
|
|
682
|
-
- `excludedCommands` in sandbox now supported
|
|
683
|
-
- v0.1.25 adds `PostToolUseFailure` hook event support
|
|
684
|
-
- v0.1.25 adds `permissionDecisionReason` to `PreToolUseHookSpecificOutput`
|
|
685
|
-
- v0.1.26 bumps bundled CLI to v2.1.27 (no new SDK features beyond PostToolUseFailure)
|
|
686
|
-
- `additionalContext` supported in `UserPromptSubmitHookSpecificOutput`
|
|
687
|
-
- `PreToolUseHookInput` does not include `tool_use_id` (unlike TypeScript)
|
|
664
|
+
- Full source available
|
|
665
|
+
- Has `Transport` abstract class and several query control methods
|
|
666
|
+
- Query supports: `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `stream_input()`, `close()`, `get_mcp_status()`
|
|
667
|
+
- Client supports: `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `get_mcp_status()`
|
|
668
|
+
- Missing hooks: SessionStart, SessionEnd, Setup
|
|
669
|
+
- Missing permission modes: `delegate`, `dontAsk`
|
|
670
|
+
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
|
|
688
671
|
- `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`
|
|
689
672
|
|
|
690
673
|
### Ruby SDK (This Repository)
|
|
691
|
-
- Full TypeScript SDK feature parity
|
|
674
|
+
- Full TypeScript SDK v0.2.31 feature parity
|
|
692
675
|
- Ruby-idiomatic patterns (Data.define, snake_case)
|
|
693
|
-
- Complete control protocol support
|
|
676
|
+
- Complete control protocol, hook, and V2 Session API support
|
|
694
677
|
- Dedicated Client class for multi-turn conversations
|
|
695
|
-
-
|
|
696
|
-
- Full V2 Session API support (unstable)
|
|
697
|
-
- `executable`/`executableArgs` marked N/A (JS runtime options not applicable to Ruby)
|
|
698
|
-
- Added: `FilesPersistedEvent` message type (new in TS v0.2.25)
|
|
699
|
-
- `claudeai-proxy` MCP server type handled transparently via Hash-based config passthrough (new in TS v0.2.25)
|
|
700
|
-
- Added: MCP tool `annotations` support (new in TS v0.2.27)
|
|
678
|
+
- `executable`/`executableArgs` marked N/A (JS runtime options)
|
|
@@ -143,7 +143,8 @@ module ClaudeAgent
|
|
|
143
143
|
structured_output: fetch_dual(raw, :structured_output),
|
|
144
144
|
errors: raw["errors"],
|
|
145
145
|
permission_denials: permission_denials,
|
|
146
|
-
model_usage: fetch_dual(raw, :model_usage)
|
|
146
|
+
model_usage: fetch_dual(raw, :model_usage),
|
|
147
|
+
stop_reason: fetch_dual(raw, :stop_reason)
|
|
147
148
|
)
|
|
148
149
|
end
|
|
149
150
|
|
|
@@ -181,7 +181,8 @@ module ClaudeAgent
|
|
|
181
181
|
:structured_output,
|
|
182
182
|
:errors, # Array<String> for error subtypes
|
|
183
183
|
:permission_denials, # Array<SDKPermissionDenial>
|
|
184
|
-
:model_usage
|
|
184
|
+
:model_usage, # Hash with per-model usage breakdown
|
|
185
|
+
:stop_reason # Why the model stopped generating (TypeScript SDK parity)
|
|
185
186
|
) do
|
|
186
187
|
def initialize(
|
|
187
188
|
subtype:,
|
|
@@ -196,7 +197,8 @@ module ClaudeAgent
|
|
|
196
197
|
structured_output: nil,
|
|
197
198
|
errors: nil,
|
|
198
199
|
permission_denials: nil,
|
|
199
|
-
model_usage: nil
|
|
200
|
+
model_usage: nil,
|
|
201
|
+
stop_reason: nil
|
|
200
202
|
)
|
|
201
203
|
super
|
|
202
204
|
end
|
data/lib/claude_agent/options.rb
CHANGED
|
@@ -41,7 +41,9 @@ module ClaudeAgent
|
|
|
41
41
|
betas: [],
|
|
42
42
|
init: false,
|
|
43
43
|
init_only: false,
|
|
44
|
-
maintenance: false
|
|
44
|
+
maintenance: false,
|
|
45
|
+
debug: false,
|
|
46
|
+
debug_file: nil
|
|
45
47
|
}.freeze
|
|
46
48
|
|
|
47
49
|
# All configurable attributes
|
|
@@ -59,6 +61,7 @@ module ClaudeAgent
|
|
|
59
61
|
persist_session betas max_buffer_size stderr_callback
|
|
60
62
|
abort_controller spawn_claude_code_process
|
|
61
63
|
init init_only maintenance
|
|
64
|
+
debug debug_file
|
|
62
65
|
].freeze
|
|
63
66
|
|
|
64
67
|
attr_accessor(*ATTRIBUTES)
|
|
@@ -88,6 +91,7 @@ module ClaudeAgent
|
|
|
88
91
|
args.concat(environment_args)
|
|
89
92
|
args.concat(output_args)
|
|
90
93
|
args.concat(setup_hook_args)
|
|
94
|
+
args.concat(debug_args)
|
|
91
95
|
args.concat(extra_cli_args)
|
|
92
96
|
end
|
|
93
97
|
end
|
|
@@ -243,6 +247,13 @@ module ClaudeAgent
|
|
|
243
247
|
end
|
|
244
248
|
end
|
|
245
249
|
|
|
250
|
+
def debug_args
|
|
251
|
+
[].tap do |args|
|
|
252
|
+
args.push("--debug") if debug
|
|
253
|
+
args.push("--debug-file", debug_file) if debug_file
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
246
257
|
def extra_cli_args
|
|
247
258
|
[].tap do |args|
|
|
248
259
|
extra_args.each do |key, value|
|
data/lib/claude_agent/version.rb
CHANGED
data/sig/claude_agent.rbs
CHANGED
|
@@ -301,6 +301,8 @@ module ClaudeAgent
|
|
|
301
301
|
# Buffering & debugging
|
|
302
302
|
attr_accessor max_buffer_size: Integer?
|
|
303
303
|
attr_accessor stderr_callback: (^(String) -> void)?
|
|
304
|
+
attr_accessor debug: bool
|
|
305
|
+
attr_accessor debug_file: String?
|
|
304
306
|
|
|
305
307
|
# Abort control (TypeScript SDK parity)
|
|
306
308
|
attr_accessor abort_controller: AbortController?
|
|
@@ -463,6 +465,7 @@ module ClaudeAgent
|
|
|
463
465
|
attr_reader errors: Array[String]?
|
|
464
466
|
attr_reader permission_denials: Array[SDKPermissionDenial]?
|
|
465
467
|
attr_reader model_usage: Hash[String, untyped]?
|
|
468
|
+
attr_reader stop_reason: String?
|
|
466
469
|
|
|
467
470
|
def initialize: (
|
|
468
471
|
subtype: String,
|
|
@@ -477,7 +480,8 @@ module ClaudeAgent
|
|
|
477
480
|
?structured_output: untyped,
|
|
478
481
|
?errors: Array[String]?,
|
|
479
482
|
?permission_denials: Array[SDKPermissionDenial]?,
|
|
480
|
-
?model_usage: Hash[String, untyped]
|
|
483
|
+
?model_usage: Hash[String, untyped]?,
|
|
484
|
+
?stop_reason: String?
|
|
481
485
|
) -> void
|
|
482
486
|
|
|
483
487
|
def type: () -> :result
|