claude_agent 0.7.1 → 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 +28 -0
- data/SPEC.md +52 -41
- data/lib/claude_agent/client.rb +9 -0
- data/lib/claude_agent/control_protocol.rb +47 -1
- data/lib/claude_agent/hooks.rb +40 -0
- data/lib/claude_agent/options.rb +6 -1
- data/lib/claude_agent/permissions.rb +4 -2
- data/lib/claude_agent/sandbox_settings.rb +3 -0
- data/lib/claude_agent/types.rb +17 -0
- data/lib/claude_agent/version.rb +1 -1
- data/sig/claude_agent.rbs +42 -2
- 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,8 +7,36 @@ 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
|
+
|
|
20
|
+
## [0.7.2] - 2026-02-05
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `description` field on `ToolPermissionContext` (TypeScript SDK v0.2.32 parity)
|
|
24
|
+
- `allow_managed_domains_only` field on `SandboxNetworkConfig`
|
|
25
|
+
- `initialization_result` method on `ControlProtocol` and `Client` with `InitializationResult`, `SlashCommand`, `ModelInfo`, and `AccountInfo` types
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- Updated SPEC.md to reference TypeScript SDK v0.2.32 and Python SDK v0.1.30
|
|
29
|
+
|
|
10
30
|
## [0.7.1] - 2026-02-03
|
|
11
31
|
|
|
32
|
+
### Added
|
|
33
|
+
- `debug` option for verbose debug logging (`--debug` CLI flag)
|
|
34
|
+
- `debug_file` option for writing debug logs to a file (`--debug-file` CLI flag)
|
|
35
|
+
- `stop_reason` field on `ResultMessage` indicating why the model stopped generating
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- Updated SPEC.md to reference TypeScript SDK v0.2.31 and Python SDK v0.1.29
|
|
39
|
+
|
|
12
40
|
## [0.7.0] - 2026-01-31
|
|
13
41
|
|
|
14
42
|
### 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,14 +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
|
-
| `
|
|
240
|
-
| `
|
|
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 |
|
|
241
243
|
|
|
242
244
|
---
|
|
243
245
|
|
|
@@ -262,6 +264,8 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
262
264
|
| `PreCompact` | ✅ | ✅ | ✅ | Before compaction |
|
|
263
265
|
| `PermissionRequest` | ✅ | ✅ | ✅ | Permission requested |
|
|
264
266
|
| `Setup` | ✅ | ❌ | ✅ | Initial setup/maintenance |
|
|
267
|
+
| `TeammateIdle` | ✅ | ❌ | ✅ | Teammate idle (v0.2.33) |
|
|
268
|
+
| `TaskCompleted` | ✅ | ❌ | ✅ | Task completed (v0.2.33) |
|
|
265
269
|
|
|
266
270
|
### Hook Input Types
|
|
267
271
|
|
|
@@ -280,6 +284,8 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
280
284
|
| `PreCompactHookInput` | ✅ | ✅ | ✅ |
|
|
281
285
|
| `PermissionRequestHookInput` | ✅ | ✅ | ✅ |
|
|
282
286
|
| `SetupHookInput` | ✅ | ❌ | ✅ |
|
|
287
|
+
| `TeammateIdleHookInput` | ✅ | ❌ | ✅ |
|
|
288
|
+
| `TaskCompletedHookInput` | ✅ | ❌ | ✅ |
|
|
283
289
|
|
|
284
290
|
### Hook Output Types
|
|
285
291
|
|
|
@@ -306,14 +312,14 @@ Event-specific fields returned via `hookSpecificOutput`:
|
|
|
306
312
|
| `permissionDecision` | ✅ | ✅ | ✅ | `allow`, `deny`, or `ask` |
|
|
307
313
|
| `permissionDecisionReason` | ✅ | ✅ | ✅ | Reason for permission decision |
|
|
308
314
|
| `updatedInput` | ✅ | ✅ | ✅ | Modified tool input |
|
|
309
|
-
| `additionalContext` | ✅ |
|
|
315
|
+
| `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
|
|
310
316
|
|
|
311
317
|
#### PostToolUseHookSpecificOutput
|
|
312
318
|
|
|
313
319
|
| Field | TypeScript | Python | Ruby | Notes |
|
|
314
320
|
|------------------------|:----------:|:------:|:----:|----------------------------------|
|
|
315
321
|
| `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
|
|
316
|
-
| `updatedMCPToolOutput` | ✅ |
|
|
322
|
+
| `updatedMCPToolOutput` | ✅ | ✅ | ✅ | Modified MCP tool output |
|
|
317
323
|
|
|
318
324
|
#### PostToolUseFailureHookSpecificOutput
|
|
319
325
|
|
|
@@ -325,7 +331,7 @@ Event-specific fields returned via `hookSpecificOutput`:
|
|
|
325
331
|
|
|
326
332
|
| Field | TypeScript | Python | Ruby | Notes |
|
|
327
333
|
|---------------------|:----------:|:------:|:----:|----------------------------------|
|
|
328
|
-
| `additionalContext` | ✅ |
|
|
334
|
+
| `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
|
|
329
335
|
|
|
330
336
|
#### SetupHookSpecificOutput
|
|
331
337
|
|
|
@@ -337,7 +343,7 @@ Event-specific fields returned via `hookSpecificOutput`:
|
|
|
337
343
|
|
|
338
344
|
| Field | TypeScript | Python | Ruby | Notes |
|
|
339
345
|
|---------------------|:----------:|:------:|:----:|----------------------------------|
|
|
340
|
-
| `additionalContext` | ✅ |
|
|
346
|
+
| `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
|
|
341
347
|
|
|
342
348
|
#### UserPromptSubmitHookSpecificOutput
|
|
343
349
|
|
|
@@ -349,13 +355,13 @@ Event-specific fields returned via `hookSpecificOutput`:
|
|
|
349
355
|
|
|
350
356
|
| Field | TypeScript | Python | Ruby | Notes |
|
|
351
357
|
|------------|:----------:|:------:|:----:|------------------------------------------|
|
|
352
|
-
| `decision` | ✅ |
|
|
358
|
+
| `decision` | ✅ | ✅ | ✅ | `{ behavior: 'allow'/'deny', ... }` obj |
|
|
353
359
|
|
|
354
360
|
#### NotificationHookSpecificOutput
|
|
355
361
|
|
|
356
362
|
| Field | TypeScript | Python | Ruby | Notes |
|
|
357
363
|
|---------------------|:----------:|:------:|:----:|----------------------------------|
|
|
358
|
-
| `additionalContext` | ✅ |
|
|
364
|
+
| `additionalContext` | ✅ | ✅ | ✅ | Context string returned to model |
|
|
359
365
|
|
|
360
366
|
### Hook Matcher
|
|
361
367
|
|
|
@@ -423,14 +429,15 @@ Permission handling and updates.
|
|
|
423
429
|
|
|
424
430
|
### ToolPermissionContext
|
|
425
431
|
|
|
426
|
-
| Field | TypeScript | Python | Ruby | Notes
|
|
427
|
-
|
|
428
|
-
| `signal` | ✅ | ✅ | ✅ | Abort signal
|
|
429
|
-
| `suggestions` | ✅ | ✅ | ✅ | Permission suggestions
|
|
430
|
-
| `blockedPath` | ✅ | ❌ | ✅ | Blocked file path
|
|
431
|
-
| `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered
|
|
432
|
-
| `toolUseID` | ✅ | ❌ | ✅ | Tool call ID
|
|
433
|
-
| `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable
|
|
432
|
+
| Field | TypeScript | Python | Ruby | Notes |
|
|
433
|
+
|------------------|:----------:|:------:|:----:|---------------------------------|
|
|
434
|
+
| `signal` | ✅ | ✅ | ✅ | Abort signal |
|
|
435
|
+
| `suggestions` | ✅ | ✅ | ✅ | Permission suggestions |
|
|
436
|
+
| `blockedPath` | ✅ | ❌ | ✅ | Blocked file path |
|
|
437
|
+
| `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered |
|
|
438
|
+
| `toolUseID` | ✅ | ❌ | ✅ | Tool call ID |
|
|
439
|
+
| `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable |
|
|
440
|
+
| `description` | ✅ | ❌ | ✅ | Human-readable tool description |
|
|
434
441
|
|
|
435
442
|
---
|
|
436
443
|
|
|
@@ -479,10 +486,10 @@ Model Context Protocol server support.
|
|
|
479
486
|
|
|
480
487
|
| Feature | TypeScript | Python | Ruby | Notes |
|
|
481
488
|
|----------------------|:----------:|:------:|:--------------------:|--------------------------|
|
|
482
|
-
| `createSdkMcpServer` | ✅ |
|
|
483
|
-
| `tool()` helper | ✅ |
|
|
484
|
-
| Tool input schema | ✅ (Zod) |
|
|
485
|
-
| Tool annotations | ✅ |
|
|
489
|
+
| `createSdkMcpServer` | ✅ | ✅ | ✅ | Create SDK server |
|
|
490
|
+
| `tool()` helper | ✅ | ✅ | ✅ | Create tool definition |
|
|
491
|
+
| Tool input schema | ✅ (Zod) | ✅ | ✅ (Hash/JSON Schema) | Schema definition |
|
|
492
|
+
| Tool annotations | ✅ | ✅ | ✅ | MCP tool hints (v0.2.27) |
|
|
486
493
|
|
|
487
494
|
---
|
|
488
495
|
|
|
@@ -549,14 +556,15 @@ Sandbox configuration for command execution isolation.
|
|
|
549
556
|
|
|
550
557
|
### SandboxNetworkConfig
|
|
551
558
|
|
|
552
|
-
| Field
|
|
553
|
-
|
|
554
|
-
| `allowedDomains`
|
|
555
|
-
| `
|
|
556
|
-
| `
|
|
557
|
-
| `
|
|
558
|
-
| `
|
|
559
|
-
| `
|
|
559
|
+
| Field | TypeScript | Python | Ruby |
|
|
560
|
+
|---------------------------|:----------:|:------:|:----:|
|
|
561
|
+
| `allowedDomains` | ✅ | ❌ | ✅ |
|
|
562
|
+
| `allowManagedDomainsOnly` | ✅ | ❌ | ✅ |
|
|
563
|
+
| `allowUnixSockets` | ✅ | ✅ | ✅ |
|
|
564
|
+
| `allowAllUnixSockets` | ✅ | ✅ | ✅ |
|
|
565
|
+
| `allowLocalBinding` | ✅ | ✅ | ✅ |
|
|
566
|
+
| `httpProxyPort` | ✅ | ✅ | ✅ |
|
|
567
|
+
| `socksProxyPort` | ✅ | ✅ | ✅ |
|
|
560
568
|
|
|
561
569
|
---
|
|
562
570
|
|
|
@@ -618,6 +626,7 @@ Public API surface for SDK clients.
|
|
|
618
626
|
| `reconnectMcpServer()` | ✅ | ❌ | ✅ | Reconnect MCP server |
|
|
619
627
|
| `toggleMcpServer()` | ✅ | ❌ | ✅ | Enable/disable MCP |
|
|
620
628
|
| `streamInput()` | ✅ | ✅ | ✅ | Stream user input |
|
|
629
|
+
| `initializationResult()` | ✅ | ❌ | ✅ | Full init response |
|
|
621
630
|
| `close()` | ✅ | ✅ | ✅ | Close query/session |
|
|
622
631
|
|
|
623
632
|
### Client Class
|
|
@@ -664,14 +673,16 @@ Public API surface for SDK clients.
|
|
|
664
673
|
- Full source available
|
|
665
674
|
- Has `Transport` abstract class and several query control methods
|
|
666
675
|
- 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
|
|
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
|
|
669
678
|
- Missing permission modes: `delegate`, `dontAsk`
|
|
670
|
-
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
|
|
679
|
+
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
|
|
671
680
|
- `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`
|
|
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)
|
|
672
683
|
|
|
673
684
|
### Ruby SDK (This Repository)
|
|
674
|
-
- 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)
|
|
675
686
|
- Ruby-idiomatic patterns (Data.define, snake_case)
|
|
676
687
|
- Complete control protocol, hook, and V2 Session API support
|
|
677
688
|
- Dedicated Client class for multi-turn conversations
|
data/lib/claude_agent/client.rb
CHANGED
|
@@ -268,6 +268,15 @@ module ClaudeAgent
|
|
|
268
268
|
@protocol.account_info
|
|
269
269
|
end
|
|
270
270
|
|
|
271
|
+
# Get full initialization result (TypeScript SDK parity)
|
|
272
|
+
#
|
|
273
|
+
# @return [InitializationResult]
|
|
274
|
+
def initialization_result
|
|
275
|
+
require_connection!
|
|
276
|
+
|
|
277
|
+
@protocol.initialization_result
|
|
278
|
+
end
|
|
279
|
+
|
|
271
280
|
# Dynamically set MCP servers for this session (TypeScript SDK parity)
|
|
272
281
|
#
|
|
273
282
|
# This replaces the current set of dynamically-added MCP servers.
|
|
@@ -324,6 +324,51 @@ module ClaudeAgent
|
|
|
324
324
|
end
|
|
325
325
|
end
|
|
326
326
|
|
|
327
|
+
# Get full initialization result (TypeScript SDK parity)
|
|
328
|
+
#
|
|
329
|
+
# Sends the supported_commands request and maps the full response including
|
|
330
|
+
# commands, output style, available output styles, models, and account info.
|
|
331
|
+
#
|
|
332
|
+
# @return [InitializationResult]
|
|
333
|
+
def initialization_result
|
|
334
|
+
response = send_control_request(subtype: "supported_commands")
|
|
335
|
+
|
|
336
|
+
commands = (response["commands"] || []).map do |cmd|
|
|
337
|
+
SlashCommand.new(
|
|
338
|
+
name: cmd["name"],
|
|
339
|
+
description: cmd["description"],
|
|
340
|
+
argument_hint: cmd["argumentHint"]
|
|
341
|
+
)
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
models = (response["models"] || []).map do |model|
|
|
345
|
+
ModelInfo.new(
|
|
346
|
+
value: model["value"],
|
|
347
|
+
display_name: model["displayName"],
|
|
348
|
+
description: model["description"]
|
|
349
|
+
)
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
account_data = response["account"]
|
|
353
|
+
account = if account_data
|
|
354
|
+
AccountInfo.new(
|
|
355
|
+
email: account_data["email"],
|
|
356
|
+
organization: account_data["organization"],
|
|
357
|
+
subscription_type: account_data["subscriptionType"],
|
|
358
|
+
token_source: account_data["tokenSource"],
|
|
359
|
+
api_key_source: account_data["apiKeySource"]
|
|
360
|
+
)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
InitializationResult.new(
|
|
364
|
+
commands: commands,
|
|
365
|
+
output_style: response["output_style"],
|
|
366
|
+
available_output_styles: response["available_output_styles"] || [],
|
|
367
|
+
models: models,
|
|
368
|
+
account: account
|
|
369
|
+
)
|
|
370
|
+
end
|
|
371
|
+
|
|
327
372
|
# Get available models (TypeScript SDK parity)
|
|
328
373
|
# @return [Array<ModelInfo>]
|
|
329
374
|
def supported_models
|
|
@@ -536,7 +581,8 @@ module ClaudeAgent
|
|
|
536
581
|
blocked_path: request["blocked_path"],
|
|
537
582
|
decision_reason: request["decision_reason"],
|
|
538
583
|
tool_use_id: request["tool_use_id"],
|
|
539
|
-
agent_id: request["agent_id"]
|
|
584
|
+
agent_id: request["agent_id"],
|
|
585
|
+
description: request["description"]
|
|
540
586
|
}
|
|
541
587
|
|
|
542
588
|
result = options.can_use_tool.call(tool_name, input, context)
|
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"
|
|
@@ -156,7 +156,8 @@ module ClaudeAgent
|
|
|
156
156
|
:decision_reason,
|
|
157
157
|
:tool_use_id,
|
|
158
158
|
:agent_id,
|
|
159
|
-
:signal
|
|
159
|
+
:signal,
|
|
160
|
+
:description
|
|
160
161
|
) do
|
|
161
162
|
def initialize(
|
|
162
163
|
permission_suggestions: nil,
|
|
@@ -164,7 +165,8 @@ module ClaudeAgent
|
|
|
164
165
|
decision_reason: nil,
|
|
165
166
|
tool_use_id: nil,
|
|
166
167
|
agent_id: nil,
|
|
167
|
-
signal: nil
|
|
168
|
+
signal: nil,
|
|
169
|
+
description: nil
|
|
168
170
|
)
|
|
169
171
|
super
|
|
170
172
|
end
|
|
@@ -15,6 +15,7 @@ module ClaudeAgent
|
|
|
15
15
|
:allow_local_binding,
|
|
16
16
|
:allow_unix_sockets,
|
|
17
17
|
:allow_all_unix_sockets,
|
|
18
|
+
:allow_managed_domains_only,
|
|
18
19
|
:http_proxy_port,
|
|
19
20
|
:socks_proxy_port
|
|
20
21
|
) do
|
|
@@ -23,6 +24,7 @@ module ClaudeAgent
|
|
|
23
24
|
allow_local_binding: false,
|
|
24
25
|
allow_unix_sockets: [],
|
|
25
26
|
allow_all_unix_sockets: false,
|
|
27
|
+
allow_managed_domains_only: false,
|
|
26
28
|
http_proxy_port: nil,
|
|
27
29
|
socks_proxy_port: nil
|
|
28
30
|
)
|
|
@@ -35,6 +37,7 @@ module ClaudeAgent
|
|
|
35
37
|
result[:allowLocalBinding] = allow_local_binding if allow_local_binding
|
|
36
38
|
result[:allowUnixSockets] = allow_unix_sockets unless allow_unix_sockets.empty?
|
|
37
39
|
result[:allowAllUnixSockets] = allow_all_unix_sockets if allow_all_unix_sockets
|
|
40
|
+
result[:allowManagedDomainsOnly] = allow_managed_domains_only if allow_managed_domains_only
|
|
38
41
|
result[:httpProxyPort] = http_proxy_port if http_proxy_port
|
|
39
42
|
result[:socksProxyPort] = socks_proxy_port if socks_proxy_port
|
|
40
43
|
result
|
data/lib/claude_agent/types.rb
CHANGED
|
@@ -80,6 +80,23 @@ module ClaudeAgent
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
# Composite initialization result from supported_commands request (TypeScript SDK parity)
|
|
84
|
+
#
|
|
85
|
+
# @example
|
|
86
|
+
# result = InitializationResult.new(
|
|
87
|
+
# commands: [SlashCommand.new(name: "commit")],
|
|
88
|
+
# output_style: "default",
|
|
89
|
+
# available_output_styles: ["default", "concise"],
|
|
90
|
+
# models: [ModelInfo.new(value: "claude-sonnet")],
|
|
91
|
+
# account: AccountInfo.new(email: "user@example.com")
|
|
92
|
+
# )
|
|
93
|
+
#
|
|
94
|
+
InitializationResult = Data.define(:commands, :output_style, :available_output_styles, :models, :account) do
|
|
95
|
+
def initialize(commands: [], output_style: nil, available_output_styles: [], models: [], account: nil)
|
|
96
|
+
super
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
83
100
|
# Per-model usage statistics returned in result messages (TypeScript SDK parity)
|
|
84
101
|
#
|
|
85
102
|
# @example
|
data/lib/claude_agent/version.rb
CHANGED
data/sig/claude_agent.rbs
CHANGED
|
@@ -114,6 +114,16 @@ module ClaudeAgent
|
|
|
114
114
|
def initialize: (?email: String?, ?organization: String?, ?subscription_type: String?, ?token_source: String?, ?api_key_source: String?) -> void
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
class InitializationResult
|
|
118
|
+
attr_reader commands: Array[SlashCommand]
|
|
119
|
+
attr_reader output_style: String?
|
|
120
|
+
attr_reader available_output_styles: Array[String]
|
|
121
|
+
attr_reader models: Array[ModelInfo]
|
|
122
|
+
attr_reader account: AccountInfo?
|
|
123
|
+
|
|
124
|
+
def initialize: (?commands: Array[SlashCommand], ?output_style: String?, ?available_output_styles: Array[String], ?models: Array[ModelInfo], ?account: AccountInfo?) -> void
|
|
125
|
+
end
|
|
126
|
+
|
|
117
127
|
class ModelUsage
|
|
118
128
|
attr_reader input_tokens: Integer
|
|
119
129
|
attr_reader output_tokens: Integer
|
|
@@ -175,10 +185,11 @@ module ClaudeAgent
|
|
|
175
185
|
attr_reader allow_local_binding: bool
|
|
176
186
|
attr_reader allow_unix_sockets: Array[String]
|
|
177
187
|
attr_reader allow_all_unix_sockets: bool
|
|
188
|
+
attr_reader allow_managed_domains_only: bool
|
|
178
189
|
attr_reader http_proxy_port: Integer?
|
|
179
190
|
attr_reader socks_proxy_port: Integer?
|
|
180
191
|
|
|
181
|
-
def initialize: (?allowed_domains: Array[String], ?allow_local_binding: bool, ?allow_unix_sockets: Array[String], ?allow_all_unix_sockets: bool, ?http_proxy_port: Integer?, ?socks_proxy_port: Integer?) -> void
|
|
192
|
+
def initialize: (?allowed_domains: Array[String], ?allow_local_binding: bool, ?allow_unix_sockets: Array[String], ?allow_all_unix_sockets: bool, ?allow_managed_domains_only: bool, ?http_proxy_port: Integer?, ?socks_proxy_port: Integer?) -> void
|
|
182
193
|
def to_h: () -> Hash[Symbol, untyped]
|
|
183
194
|
end
|
|
184
195
|
|
|
@@ -254,6 +265,7 @@ module ClaudeAgent
|
|
|
254
265
|
attr_accessor resume: String?
|
|
255
266
|
attr_accessor fork_session: bool
|
|
256
267
|
attr_accessor resume_session_at: String?
|
|
268
|
+
attr_accessor session_id: String?
|
|
257
269
|
attr_accessor persist_session: bool
|
|
258
270
|
|
|
259
271
|
# Limits & budget
|
|
@@ -757,6 +769,31 @@ module ClaudeAgent
|
|
|
757
769
|
def initialize: (tool_name: String, tool_input: Hash[String, untyped], ?permission_suggestions: untyped, **untyped) -> void
|
|
758
770
|
end
|
|
759
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
|
+
|
|
760
797
|
# Permission types
|
|
761
798
|
type permission_result = PermissionResultAllow | PermissionResultDeny
|
|
762
799
|
|
|
@@ -810,8 +847,9 @@ module ClaudeAgent
|
|
|
810
847
|
attr_reader tool_use_id: String?
|
|
811
848
|
attr_reader agent_id: String?
|
|
812
849
|
attr_reader signal: AbortSignal?
|
|
850
|
+
attr_reader description: String?
|
|
813
851
|
|
|
814
|
-
def initialize: (?permission_suggestions: untyped, ?blocked_path: String?, ?decision_reason: String?, ?tool_use_id: String?, ?agent_id: String?, ?signal: AbortSignal?) -> void
|
|
852
|
+
def initialize: (?permission_suggestions: untyped, ?blocked_path: String?, ?decision_reason: String?, ?tool_use_id: String?, ?agent_id: String?, ?signal: AbortSignal?, ?description: String?) -> void
|
|
815
853
|
end
|
|
816
854
|
|
|
817
855
|
# Client
|
|
@@ -847,6 +885,7 @@ module ClaudeAgent
|
|
|
847
885
|
def supported_models: () -> Array[ModelInfo]
|
|
848
886
|
def mcp_server_status: () -> Array[McpServerStatus]
|
|
849
887
|
def account_info: () -> AccountInfo
|
|
888
|
+
def initialization_result: () -> InitializationResult
|
|
850
889
|
end
|
|
851
890
|
|
|
852
891
|
# Control protocol
|
|
@@ -882,6 +921,7 @@ module ClaudeAgent
|
|
|
882
921
|
def supported_models: () -> Array[ModelInfo]
|
|
883
922
|
def mcp_server_status: () -> Array[McpServerStatus]
|
|
884
923
|
def account_info: () -> AccountInfo
|
|
924
|
+
def initialization_result: () -> InitializationResult
|
|
885
925
|
end
|
|
886
926
|
|
|
887
927
|
# Transport layer
|