claude_agent 0.7.6 → 0.7.7
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/.worktreeinclude +13 -0
- data/CHANGELOG.md +10 -0
- data/SPEC.md +28 -9
- data/lib/claude_agent/control_protocol.rb +1 -0
- data/lib/claude_agent/hooks.rb +26 -0
- data/lib/claude_agent/message_parser.rb +34 -1
- data/lib/claude_agent/messages.rb +98 -1
- data/lib/claude_agent/options.rb +4 -2
- data/lib/claude_agent/sandbox_settings.rb +28 -2
- data/lib/claude_agent/version.rb +1 -1
- data/sig/claude_agent.rbs +58 -2
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d3e15e24cc94819c7790d628776f0f04aee71592ae3b2eff9daa40b47941302
|
|
4
|
+
data.tar.gz: 9b60ffaf27391f41168549ac9bb878a9d184f4edf0144916b268e79855dddc65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '084b53215d8f9f9d95f2084d6c7b0e10a845bd028ad5e466ce7c822e245351b59916782f36591ab0f0088f996d27c127221843a603217bc2eb7adf569708aa85'
|
|
7
|
+
data.tar.gz: 1b30bec791d154c017daee5aa6ca93df25da998a19382554aae3610962c447294cce76bbdb96737614f7334bdc73cd3be148a3a8138bfa50bf9ef8d130a05f3d
|
data/.worktreeinclude
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Files to copy to new worktrees (must also be in .gitignore)
|
|
2
|
+
|
|
3
|
+
# Claude Configs
|
|
4
|
+
.claude/settings.local.json
|
|
5
|
+
.claude/**/local-*
|
|
6
|
+
.claude/**/local/
|
|
7
|
+
|
|
8
|
+
# MCP server configuration
|
|
9
|
+
.mcp.json
|
|
10
|
+
|
|
11
|
+
# Local dependencies and temp files
|
|
12
|
+
/tmp/**
|
|
13
|
+
/vendor/**
|
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.7] - 2026-02-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `TaskStartedMessage` for background task start notifications (TypeScript SDK v0.2.43 parity)
|
|
14
|
+
- `RateLimitEvent` message type for rate limit visibility (TypeScript SDK v0.2.44 parity)
|
|
15
|
+
- `PromptSuggestionMessage` type and `prompt_suggestions` option for suggested follow-up prompts (TypeScript SDK v0.2.46 parity)
|
|
16
|
+
- `ConfigChange` hook event with `ConfigChangeInput` class (TypeScript SDK v0.2.47 parity)
|
|
17
|
+
- `SandboxFilesystemConfig` with `allow_write`, `deny_write`, `deny_read` fields (TypeScript SDK v0.2.49 parity)
|
|
18
|
+
- RBS signatures for all new types
|
|
19
|
+
|
|
10
20
|
## [0.7.6] - 2026-02-13
|
|
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.49 (npm package)
|
|
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-20
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -41,7 +41,7 @@ Configuration options for SDK queries and clients.
|
|
|
41
41
|
| `tools` | ✅ | ✅ | ✅ | Array or preset |
|
|
42
42
|
| `allowedTools` | ✅ | ✅ | ✅ | Auto-allowed tools |
|
|
43
43
|
| `disallowedTools` | ✅ | ✅ | ✅ | Blocked tools |
|
|
44
|
-
| `permissionMode` | ✅ | ✅ | ✅ | default/acceptEdits/plan/bypassPermissions/
|
|
44
|
+
| `permissionMode` | ✅ | ✅ | ✅ | default/acceptEdits/plan/bypassPermissions/dontAsk |
|
|
45
45
|
| `allowDangerouslySkipPermissions` | ✅ | ❌ | ✅ | Required for bypassPermissions |
|
|
46
46
|
| `canUseTool` | ✅ | ✅ | ✅ | Permission callback |
|
|
47
47
|
| `permissionPromptToolName` | ✅ | ✅ | ✅ | MCP tool for permission prompts |
|
|
@@ -83,6 +83,7 @@ Configuration options for SDK queries and clients.
|
|
|
83
83
|
| `init` | ✅ | ❌ | ✅ | Run Setup hooks (init trigger), then continue (hidden CLI) |
|
|
84
84
|
| `initOnly` | ✅ | ❌ | ✅ | Run Setup hooks (init trigger), then exit (hidden CLI) |
|
|
85
85
|
| `maintenance` | ✅ | ❌ | ✅ | Run Setup hooks (maintenance trigger), continue (hidden CLI) |
|
|
86
|
+
| `promptSuggestions` | ✅ | ❌ | ✅ | Enable prompt suggestion after each turn (v0.2.47) |
|
|
86
87
|
| `debug` | ✅ | ❌ | ✅ | Enable verbose debug logging |
|
|
87
88
|
| `debugFile` | ✅ | ❌ | ✅ | Write debug logs to specific file path |
|
|
88
89
|
|
|
@@ -109,6 +110,9 @@ Messages exchanged between SDK and CLI.
|
|
|
109
110
|
| `AuthStatusMessage` | ✅ | ❌ | ✅ | Authentication status |
|
|
110
111
|
| `TaskNotificationMessage` | ✅ | ❌ | ✅ | Background task completion |
|
|
111
112
|
| `ToolUseSummaryMessage` | ✅ | ❌ | ✅ | Summary of tool use (collapsed) |
|
|
113
|
+
| `TaskStartedMessage` | ✅ | ❌ | ✅ | Subagent task registered (v0.2.45) |
|
|
114
|
+
| `RateLimitEvent` | ✅ | ❌ | ✅ | Rate limit status changes |
|
|
115
|
+
| `PromptSuggestionMessage` | ✅ | ❌ | ✅ | Suggested next prompt (v0.2.47) |
|
|
112
116
|
| `FilesPersistedEvent` | ✅ | ❌ | ✅ | File persistence confirmation |
|
|
113
117
|
|
|
114
118
|
### Message Fields
|
|
@@ -269,6 +273,7 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
269
273
|
| `Setup` | ✅ | ❌ | ✅ | Initial setup/maintenance |
|
|
270
274
|
| `TeammateIdle` | ✅ | ❌ | ✅ | Teammate idle (v0.2.33) |
|
|
271
275
|
| `TaskCompleted` | ✅ | ❌ | ✅ | Task completed (v0.2.33) |
|
|
276
|
+
| `ConfigChange` | ✅ | ❌ | ✅ | Config file changed (v0.2.49) |
|
|
272
277
|
|
|
273
278
|
### Hook Input Types
|
|
274
279
|
|
|
@@ -289,6 +294,7 @@ Event hooks for intercepting and modifying SDK behavior.
|
|
|
289
294
|
| `SetupHookInput` | ✅ | ❌ | ✅ |
|
|
290
295
|
| `TeammateIdleHookInput` | ✅ | ❌ | ✅ |
|
|
291
296
|
| `TaskCompletedHookInput` | ✅ | ❌ | ✅ |
|
|
297
|
+
| `ConfigChangeHookInput` | ✅ | ❌ | ✅ |
|
|
292
298
|
|
|
293
299
|
### Hook Output Types
|
|
294
300
|
|
|
@@ -388,7 +394,6 @@ Permission handling and updates.
|
|
|
388
394
|
| `acceptEdits` | ✅ | ✅ | ✅ | Auto-accept edits |
|
|
389
395
|
| `plan` | ✅ | ✅ | ✅ | Planning mode |
|
|
390
396
|
| `bypassPermissions` | ✅ | ✅ | ✅ | Skip all checks |
|
|
391
|
-
| `delegate` | ✅ | ❌ | ✅ | Delegate mode |
|
|
392
397
|
| `dontAsk` | ✅ | ❌ | ✅ | Never prompt |
|
|
393
398
|
|
|
394
399
|
### Permission Result Types
|
|
@@ -556,6 +561,15 @@ Sandbox configuration for command execution isolation.
|
|
|
556
561
|
| `ignoreViolations` | ✅ | ✅ | ✅ |
|
|
557
562
|
| `enableWeakerNestedSandbox` | ✅ | ✅ | ✅ |
|
|
558
563
|
| `ripgrep` | ✅ | ❌ | ✅ |
|
|
564
|
+
| `filesystem` | ✅ | ❌ | ✅ |
|
|
565
|
+
|
|
566
|
+
### SandboxFilesystemConfig
|
|
567
|
+
|
|
568
|
+
| Field | TypeScript | Python | Ruby |
|
|
569
|
+
|--------------|:----------:|:------:|:----:|
|
|
570
|
+
| `allowWrite` | ✅ | ❌ | ✅ |
|
|
571
|
+
| `denyWrite` | ✅ | ❌ | ✅ |
|
|
572
|
+
| `denyRead` | ✅ | ❌ | ✅ |
|
|
559
573
|
|
|
560
574
|
### SandboxNetworkConfig
|
|
561
575
|
|
|
@@ -673,20 +687,25 @@ Public API surface for SDK clients.
|
|
|
673
687
|
- Source is bundled/minified, but `sdk.d.ts` provides complete type definitions
|
|
674
688
|
- Includes unstable V2 session API
|
|
675
689
|
- `executable`/`executableArgs` are JS-specific (`node`/`bun`/`deno`)
|
|
690
|
+
- v0.2.45: Added `TaskStartedMessage`, `RateLimitEvent` message types
|
|
691
|
+
- v0.2.47: Added `promptSuggestions` option and `PromptSuggestionMessage`
|
|
692
|
+
- v0.2.49: Added `ConfigChange` hook event, `SandboxFilesystemConfig`
|
|
676
693
|
|
|
677
694
|
### Python SDK
|
|
678
695
|
- Full source available with `Transport` abstract class
|
|
679
696
|
- Partial control protocol: query and client support interrupt, setPermissionMode, setModel, rewindFiles, mcpStatus
|
|
680
|
-
- Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted
|
|
681
|
-
- Missing permission modes: `
|
|
682
|
-
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`
|
|
697
|
+
- Missing hooks: SessionStart, SessionEnd, Setup, TeammateIdle, TaskCompleted, ConfigChange
|
|
698
|
+
- Missing permission modes: `dontAsk`
|
|
699
|
+
- Missing options: `allowDangerouslySkipPermissions`, `persistSession`, `resumeSessionAt`, `sessionId`, `strictMcpConfig`, `init`/`initOnly`/`maintenance`, `debug`/`debugFile`, `promptSuggestions`
|
|
683
700
|
- `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`, `description`
|
|
684
701
|
- Has SDK MCP server support with `tool()` helper and annotations
|
|
685
702
|
- Added `thinking` config and `effort` option in v0.1.36
|
|
703
|
+
- Handles `rate_limit_event` and unknown message types gracefully (v0.1.39)
|
|
686
704
|
|
|
687
705
|
### Ruby SDK (This Repository)
|
|
688
|
-
-
|
|
706
|
+
- Feature parity with TypeScript SDK v0.2.42
|
|
689
707
|
- Ruby-idiomatic patterns (Data.define, snake_case)
|
|
690
708
|
- Complete control protocol, hook, and V2 Session API support
|
|
691
709
|
- Dedicated Client class for multi-turn conversations
|
|
692
710
|
- `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/hooks.rb
CHANGED
|
@@ -18,6 +18,7 @@ module ClaudeAgent
|
|
|
18
18
|
Setup
|
|
19
19
|
TeammateIdle
|
|
20
20
|
TaskCompleted
|
|
21
|
+
ConfigChange
|
|
21
22
|
].freeze
|
|
22
23
|
|
|
23
24
|
# Matcher configuration for hooks
|
|
@@ -278,6 +279,31 @@ module ClaudeAgent
|
|
|
278
279
|
end
|
|
279
280
|
end
|
|
280
281
|
|
|
282
|
+
# Input for ConfigChange hook (TypeScript SDK v0.2.49 parity)
|
|
283
|
+
#
|
|
284
|
+
# Fired when a configuration file changes.
|
|
285
|
+
#
|
|
286
|
+
# @example
|
|
287
|
+
# input = ConfigChangeInput.new(
|
|
288
|
+
# source: "user_settings",
|
|
289
|
+
# file_path: "~/.claude/settings.json",
|
|
290
|
+
# session_id: "sess-123"
|
|
291
|
+
# )
|
|
292
|
+
#
|
|
293
|
+
class ConfigChangeInput < BaseHookInput
|
|
294
|
+
attr_reader :source, :file_path
|
|
295
|
+
|
|
296
|
+
SOURCES = %w[user_settings project_settings local_settings policy_settings skills].freeze
|
|
297
|
+
|
|
298
|
+
# @param source [String] One of SOURCES
|
|
299
|
+
# @param file_path [String, nil] Path to the changed file
|
|
300
|
+
def initialize(source:, file_path: nil, **kwargs)
|
|
301
|
+
super(hook_event_name: "ConfigChange", **kwargs)
|
|
302
|
+
@source = source
|
|
303
|
+
@file_path = file_path
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
281
307
|
# Input for TaskCompleted hook (TypeScript SDK v0.2.33 parity)
|
|
282
308
|
#
|
|
283
309
|
# Fired when a task completes.
|
|
@@ -16,7 +16,7 @@ module ClaudeAgent
|
|
|
16
16
|
# Parse a raw message hash into a typed message object
|
|
17
17
|
#
|
|
18
18
|
# @param raw [Hash] Raw message from CLI
|
|
19
|
-
# @return [UserMessage, UserMessageReplay, AssistantMessage, SystemMessage, ResultMessage, StreamEvent, CompactBoundaryMessage, StatusMessage, ToolProgressMessage, HookResponseMessage, AuthStatusMessage, TaskNotificationMessage, HookStartedMessage, HookProgressMessage, ToolUseSummaryMessage, FilesPersistedEvent]
|
|
19
|
+
# @return [UserMessage, UserMessageReplay, AssistantMessage, SystemMessage, ResultMessage, StreamEvent, CompactBoundaryMessage, StatusMessage, ToolProgressMessage, HookResponseMessage, AuthStatusMessage, TaskNotificationMessage, HookStartedMessage, HookProgressMessage, ToolUseSummaryMessage, FilesPersistedEvent, TaskStartedMessage, RateLimitEvent, PromptSuggestionMessage]
|
|
20
20
|
# @raise [MessageParseError] If message cannot be parsed
|
|
21
21
|
def parse(raw)
|
|
22
22
|
type = raw["type"]
|
|
@@ -44,6 +44,8 @@ module ClaudeAgent
|
|
|
44
44
|
parse_hook_progress_message(raw)
|
|
45
45
|
when "files_persisted"
|
|
46
46
|
parse_files_persisted_event(raw)
|
|
47
|
+
when "task_started"
|
|
48
|
+
parse_task_started_message(raw)
|
|
47
49
|
else
|
|
48
50
|
parse_system_message(raw)
|
|
49
51
|
end
|
|
@@ -57,6 +59,10 @@ module ClaudeAgent
|
|
|
57
59
|
parse_auth_status_message(raw)
|
|
58
60
|
when "tool_use_summary"
|
|
59
61
|
parse_tool_use_summary_message(raw)
|
|
62
|
+
when "rate_limit_event"
|
|
63
|
+
parse_rate_limit_event(raw)
|
|
64
|
+
when "prompt_suggestion"
|
|
65
|
+
parse_prompt_suggestion_message(raw)
|
|
60
66
|
else
|
|
61
67
|
logger.error("parser") { "Unknown message type: #{type}" }
|
|
62
68
|
raise MessageParseError.new("Unknown message type: #{type}", raw_message: raw)
|
|
@@ -336,5 +342,32 @@ module ClaudeAgent
|
|
|
336
342
|
processed_at: fetch_dual(raw, :processed_at)
|
|
337
343
|
)
|
|
338
344
|
end
|
|
345
|
+
|
|
346
|
+
def parse_task_started_message(raw)
|
|
347
|
+
TaskStartedMessage.new(
|
|
348
|
+
uuid: raw["uuid"] || "",
|
|
349
|
+
session_id: fetch_dual(raw, :session_id, ""),
|
|
350
|
+
task_id: fetch_dual(raw, :task_id, ""),
|
|
351
|
+
tool_use_id: fetch_dual(raw, :tool_use_id),
|
|
352
|
+
description: raw["description"],
|
|
353
|
+
task_type: fetch_dual(raw, :task_type)
|
|
354
|
+
)
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
def parse_rate_limit_event(raw)
|
|
358
|
+
RateLimitEvent.new(
|
|
359
|
+
rate_limit_info: fetch_dual(raw, :rate_limit_info, {}),
|
|
360
|
+
uuid: raw["uuid"] || "",
|
|
361
|
+
session_id: fetch_dual(raw, :session_id, "")
|
|
362
|
+
)
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
def parse_prompt_suggestion_message(raw)
|
|
366
|
+
PromptSuggestionMessage.new(
|
|
367
|
+
uuid: raw["uuid"] || "",
|
|
368
|
+
session_id: fetch_dual(raw, :session_id, ""),
|
|
369
|
+
suggestion: raw["suggestion"] || ""
|
|
370
|
+
)
|
|
371
|
+
end
|
|
339
372
|
end
|
|
340
373
|
end
|
|
@@ -616,6 +616,100 @@ module ClaudeAgent
|
|
|
616
616
|
end
|
|
617
617
|
end
|
|
618
618
|
|
|
619
|
+
# Task started message (TypeScript SDK v0.2.45 parity)
|
|
620
|
+
#
|
|
621
|
+
# Sent when a new task (subagent) is started.
|
|
622
|
+
#
|
|
623
|
+
# @example
|
|
624
|
+
# msg = TaskStartedMessage.new(
|
|
625
|
+
# uuid: "msg-123",
|
|
626
|
+
# session_id: "session-abc",
|
|
627
|
+
# task_id: "task-456",
|
|
628
|
+
# tool_use_id: "tool-789",
|
|
629
|
+
# description: "Running tests",
|
|
630
|
+
# task_type: "bash"
|
|
631
|
+
# )
|
|
632
|
+
#
|
|
633
|
+
TaskStartedMessage = Data.define(
|
|
634
|
+
:uuid,
|
|
635
|
+
:session_id,
|
|
636
|
+
:task_id,
|
|
637
|
+
:tool_use_id,
|
|
638
|
+
:description,
|
|
639
|
+
:task_type
|
|
640
|
+
) do
|
|
641
|
+
def initialize(
|
|
642
|
+
uuid:,
|
|
643
|
+
session_id:,
|
|
644
|
+
task_id:,
|
|
645
|
+
tool_use_id: nil,
|
|
646
|
+
description: nil,
|
|
647
|
+
task_type: nil
|
|
648
|
+
)
|
|
649
|
+
super
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
def type
|
|
653
|
+
:task_started
|
|
654
|
+
end
|
|
655
|
+
end
|
|
656
|
+
|
|
657
|
+
# Rate limit event (TypeScript SDK v0.2.45 parity)
|
|
658
|
+
#
|
|
659
|
+
# Reports rate limit status and utilization information.
|
|
660
|
+
#
|
|
661
|
+
# @example
|
|
662
|
+
# msg = RateLimitEvent.new(
|
|
663
|
+
# uuid: "msg-123",
|
|
664
|
+
# session_id: "session-abc",
|
|
665
|
+
# rate_limit_info: {
|
|
666
|
+
# "status" => "allowed_warning",
|
|
667
|
+
# "resetsAt" => 1700000000,
|
|
668
|
+
# "rateLimitType" => "five_hour",
|
|
669
|
+
# "utilization" => 0.85,
|
|
670
|
+
# "isUsingOverage" => false,
|
|
671
|
+
# "overageStatus" => "available"
|
|
672
|
+
# }
|
|
673
|
+
# )
|
|
674
|
+
# msg.status # => "allowed_warning"
|
|
675
|
+
#
|
|
676
|
+
RateLimitEvent = Data.define(:rate_limit_info, :uuid, :session_id) do
|
|
677
|
+
def initialize(rate_limit_info:, uuid: nil, session_id: nil)
|
|
678
|
+
super
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
def type
|
|
682
|
+
:rate_limit_event
|
|
683
|
+
end
|
|
684
|
+
|
|
685
|
+
# Get the rate limit status
|
|
686
|
+
# @return [String, nil]
|
|
687
|
+
def status
|
|
688
|
+
rate_limit_info["status"] || rate_limit_info[:status]
|
|
689
|
+
end
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
# Prompt suggestion message (TypeScript SDK v0.2.47 parity)
|
|
693
|
+
#
|
|
694
|
+
# Contains a suggested prompt for the user.
|
|
695
|
+
#
|
|
696
|
+
# @example
|
|
697
|
+
# msg = PromptSuggestionMessage.new(
|
|
698
|
+
# uuid: "msg-123",
|
|
699
|
+
# session_id: "session-abc",
|
|
700
|
+
# suggestion: "Tell me about this project"
|
|
701
|
+
# )
|
|
702
|
+
#
|
|
703
|
+
PromptSuggestionMessage = Data.define(:uuid, :session_id, :suggestion) do
|
|
704
|
+
def initialize(uuid: nil, session_id: nil, suggestion:)
|
|
705
|
+
super
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
def type
|
|
709
|
+
:prompt_suggestion
|
|
710
|
+
end
|
|
711
|
+
end
|
|
712
|
+
|
|
619
713
|
# Files persisted event (TypeScript SDK v0.2.25 parity)
|
|
620
714
|
#
|
|
621
715
|
# Sent when files are persisted to storage during a session.
|
|
@@ -670,6 +764,9 @@ module ClaudeAgent
|
|
|
670
764
|
HookStartedMessage,
|
|
671
765
|
HookProgressMessage,
|
|
672
766
|
ToolUseSummaryMessage,
|
|
673
|
-
FilesPersistedEvent
|
|
767
|
+
FilesPersistedEvent,
|
|
768
|
+
TaskStartedMessage,
|
|
769
|
+
RateLimitEvent,
|
|
770
|
+
PromptSuggestionMessage
|
|
674
771
|
].freeze
|
|
675
772
|
end
|
data/lib/claude_agent/options.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
module ClaudeAgent
|
|
6
6
|
# Permission modes for tool execution (TypeScript SDK parity)
|
|
7
|
-
PERMISSION_MODES = %w[default acceptEdits plan bypassPermissions
|
|
7
|
+
PERMISSION_MODES = %w[default acceptEdits plan bypassPermissions dontAsk].freeze
|
|
8
8
|
|
|
9
9
|
# Configuration options for ClaudeAgent queries and clients
|
|
10
10
|
#
|
|
@@ -42,6 +42,7 @@ module ClaudeAgent
|
|
|
42
42
|
init: false,
|
|
43
43
|
init_only: false,
|
|
44
44
|
maintenance: false,
|
|
45
|
+
prompt_suggestions: false,
|
|
45
46
|
debug: false,
|
|
46
47
|
debug_file: nil
|
|
47
48
|
}.freeze
|
|
@@ -61,7 +62,7 @@ module ClaudeAgent
|
|
|
61
62
|
settings sandbox cwd add_dirs env user agent
|
|
62
63
|
cli_path extra_args agents setting_sources plugins
|
|
63
64
|
include_partial_messages output_format enable_file_checkpointing
|
|
64
|
-
persist_session betas max_buffer_size stderr_callback
|
|
65
|
+
persist_session prompt_suggestions betas max_buffer_size stderr_callback
|
|
65
66
|
abort_controller spawn_claude_code_process
|
|
66
67
|
init init_only maintenance
|
|
67
68
|
debug debug_file
|
|
@@ -260,6 +261,7 @@ module ClaudeAgent
|
|
|
260
261
|
args.push("--no-persist-session") if persist_session == false
|
|
261
262
|
args.push("--json-schema", JSON.generate(output_format)) if output_format
|
|
262
263
|
args.push("--include-partial-messages") if include_partial_messages
|
|
264
|
+
args.push("--prompt-suggestions") if prompt_suggestions
|
|
263
265
|
if agents
|
|
264
266
|
agents_hash = agents.transform_values(&:to_h)
|
|
265
267
|
args.push("--agents", JSON.generate(agents_hash))
|
|
@@ -85,6 +85,29 @@ module ClaudeAgent
|
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# Filesystem-specific configuration for sandbox mode (TypeScript SDK v0.2.49 parity)
|
|
89
|
+
#
|
|
90
|
+
# @example
|
|
91
|
+
# filesystem = SandboxFilesystemConfig.new(
|
|
92
|
+
# allow_write: ["/tmp/*"],
|
|
93
|
+
# deny_write: ["/etc/*"],
|
|
94
|
+
# deny_read: ["/secrets/*"]
|
|
95
|
+
# )
|
|
96
|
+
#
|
|
97
|
+
SandboxFilesystemConfig = Data.define(:allow_write, :deny_write, :deny_read) do
|
|
98
|
+
def initialize(allow_write: [], deny_write: [], deny_read: [])
|
|
99
|
+
super
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def to_h
|
|
103
|
+
result = {}
|
|
104
|
+
result[:allowWrite] = allow_write unless allow_write.empty?
|
|
105
|
+
result[:denyWrite] = deny_write unless deny_write.empty?
|
|
106
|
+
result[:denyRead] = deny_read unless deny_read.empty?
|
|
107
|
+
result
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
88
111
|
# Sandbox configuration for command execution (TypeScript SDK parity)
|
|
89
112
|
#
|
|
90
113
|
# @example Basic sandbox
|
|
@@ -112,7 +135,8 @@ module ClaudeAgent
|
|
|
112
135
|
:network,
|
|
113
136
|
:ignore_violations,
|
|
114
137
|
:enable_weaker_nested_sandbox,
|
|
115
|
-
:ripgrep
|
|
138
|
+
:ripgrep,
|
|
139
|
+
:filesystem
|
|
116
140
|
) do
|
|
117
141
|
def initialize(
|
|
118
142
|
enabled: false,
|
|
@@ -122,7 +146,8 @@ module ClaudeAgent
|
|
|
122
146
|
network: nil,
|
|
123
147
|
ignore_violations: nil,
|
|
124
148
|
enable_weaker_nested_sandbox: false,
|
|
125
|
-
ripgrep: nil
|
|
149
|
+
ripgrep: nil,
|
|
150
|
+
filesystem: nil
|
|
126
151
|
)
|
|
127
152
|
super
|
|
128
153
|
end
|
|
@@ -136,6 +161,7 @@ module ClaudeAgent
|
|
|
136
161
|
result[:ignoreViolations] = ignore_violations.to_h if ignore_violations && !ignore_violations.to_h.empty?
|
|
137
162
|
result[:enableWeakerNestedSandbox] = enable_weaker_nested_sandbox if enable_weaker_nested_sandbox
|
|
138
163
|
result[:ripgrep] = ripgrep.to_h if ripgrep
|
|
164
|
+
result[:filesystem] = filesystem.to_h if filesystem && !filesystem.to_h.empty?
|
|
139
165
|
result
|
|
140
166
|
end
|
|
141
167
|
end
|
data/lib/claude_agent/version.rb
CHANGED
data/sig/claude_agent.rbs
CHANGED
|
@@ -231,6 +231,15 @@ module ClaudeAgent
|
|
|
231
231
|
def to_h: () -> Hash[Symbol, untyped]
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
+
class SandboxFilesystemConfig
|
|
235
|
+
attr_reader allow_write: Array[String]
|
|
236
|
+
attr_reader deny_write: Array[String]
|
|
237
|
+
attr_reader deny_read: Array[String]
|
|
238
|
+
|
|
239
|
+
def initialize: (?allow_write: Array[String], ?deny_write: Array[String], ?deny_read: Array[String]) -> void
|
|
240
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
241
|
+
end
|
|
242
|
+
|
|
234
243
|
class SandboxSettings
|
|
235
244
|
attr_reader enabled: bool
|
|
236
245
|
attr_reader auto_allow_bash_if_sandboxed: bool
|
|
@@ -240,8 +249,9 @@ module ClaudeAgent
|
|
|
240
249
|
attr_reader ignore_violations: SandboxIgnoreViolations?
|
|
241
250
|
attr_reader enable_weaker_nested_sandbox: bool
|
|
242
251
|
attr_reader ripgrep: SandboxRipgrepConfig?
|
|
252
|
+
attr_reader filesystem: SandboxFilesystemConfig?
|
|
243
253
|
|
|
244
|
-
def initialize: (?enabled: bool, ?auto_allow_bash_if_sandboxed: bool, ?excluded_commands: Array[String], ?allow_unsandboxed_commands: bool, ?network: SandboxNetworkConfig?, ?ignore_violations: SandboxIgnoreViolations?, ?enable_weaker_nested_sandbox: bool, ?ripgrep: SandboxRipgrepConfig?) -> void
|
|
254
|
+
def initialize: (?enabled: bool, ?auto_allow_bash_if_sandboxed: bool, ?excluded_commands: Array[String], ?allow_unsandboxed_commands: bool, ?network: SandboxNetworkConfig?, ?ignore_violations: SandboxIgnoreViolations?, ?enable_weaker_nested_sandbox: bool, ?ripgrep: SandboxRipgrepConfig?, ?filesystem: SandboxFilesystemConfig?) -> void
|
|
245
255
|
def to_h: () -> Hash[Symbol, untyped]
|
|
246
256
|
end
|
|
247
257
|
|
|
@@ -332,6 +342,9 @@ module ClaudeAgent
|
|
|
332
342
|
attr_accessor output_format: Hash[String, untyped]?
|
|
333
343
|
attr_accessor enable_file_checkpointing: bool
|
|
334
344
|
|
|
345
|
+
# Prompt suggestions
|
|
346
|
+
attr_accessor prompt_suggestions: bool
|
|
347
|
+
|
|
335
348
|
# Beta features
|
|
336
349
|
attr_accessor betas: Array[String]
|
|
337
350
|
|
|
@@ -436,7 +449,7 @@ module ClaudeAgent
|
|
|
436
449
|
CONTENT_BLOCK_TYPES: Array[Class]
|
|
437
450
|
|
|
438
451
|
# Message types
|
|
439
|
-
type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent
|
|
452
|
+
type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent | TaskStartedMessage | RateLimitEvent | PromptSuggestionMessage
|
|
440
453
|
|
|
441
454
|
MESSAGE_TYPES: Array[Class]
|
|
442
455
|
|
|
@@ -673,6 +686,40 @@ module ClaudeAgent
|
|
|
673
686
|
def type: () -> :files_persisted
|
|
674
687
|
end
|
|
675
688
|
|
|
689
|
+
# Task started message (TypeScript SDK v0.2.45 parity)
|
|
690
|
+
class TaskStartedMessage
|
|
691
|
+
attr_reader uuid: String
|
|
692
|
+
attr_reader session_id: String
|
|
693
|
+
attr_reader task_id: String
|
|
694
|
+
attr_reader tool_use_id: String?
|
|
695
|
+
attr_reader description: String?
|
|
696
|
+
attr_reader task_type: String?
|
|
697
|
+
|
|
698
|
+
def initialize: (uuid: String, session_id: String, task_id: String, ?tool_use_id: String?, ?description: String?, ?task_type: String?) -> void
|
|
699
|
+
def type: () -> :task_started
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
# Rate limit event (TypeScript SDK v0.2.45 parity)
|
|
703
|
+
class RateLimitEvent
|
|
704
|
+
attr_reader rate_limit_info: Hash[String, untyped]
|
|
705
|
+
attr_reader uuid: String?
|
|
706
|
+
attr_reader session_id: String?
|
|
707
|
+
|
|
708
|
+
def initialize: (rate_limit_info: Hash[String, untyped], ?uuid: String?, ?session_id: String?) -> void
|
|
709
|
+
def type: () -> :rate_limit_event
|
|
710
|
+
def status: () -> String?
|
|
711
|
+
end
|
|
712
|
+
|
|
713
|
+
# Prompt suggestion message (TypeScript SDK v0.2.47 parity)
|
|
714
|
+
class PromptSuggestionMessage
|
|
715
|
+
attr_reader uuid: String?
|
|
716
|
+
attr_reader session_id: String?
|
|
717
|
+
attr_reader suggestion: String
|
|
718
|
+
|
|
719
|
+
def initialize: (?uuid: String?, ?session_id: String?, suggestion: String) -> void
|
|
720
|
+
def type: () -> :prompt_suggestion
|
|
721
|
+
end
|
|
722
|
+
|
|
676
723
|
# Message parser
|
|
677
724
|
class MessageParser
|
|
678
725
|
def initialize: (?logger: Logger?) -> void
|
|
@@ -823,6 +870,15 @@ module ClaudeAgent
|
|
|
823
870
|
def initialize: (task_id: String, task_subject: String, ?task_description: String?, ?teammate_name: String?, ?team_name: String?, **untyped) -> void
|
|
824
871
|
end
|
|
825
872
|
|
|
873
|
+
class ConfigChangeInput < BaseHookInput
|
|
874
|
+
attr_reader source: String
|
|
875
|
+
attr_reader file_path: String?
|
|
876
|
+
|
|
877
|
+
SOURCES: Array[String]
|
|
878
|
+
|
|
879
|
+
def initialize: (source: String, ?file_path: String?, **untyped) -> void
|
|
880
|
+
end
|
|
881
|
+
|
|
826
882
|
# Permission types
|
|
827
883
|
type permission_result = PermissionResultAllow | PermissionResultDeny
|
|
828
884
|
|
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.7.
|
|
4
|
+
version: 0.7.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Carr
|
|
@@ -43,6 +43,7 @@ files:
|
|
|
43
43
|
- ".claude/skills/spec/SKILL.md"
|
|
44
44
|
- ".claude/skills/spec/commands/complete.md"
|
|
45
45
|
- ".claude/skills/spec/commands/update.md"
|
|
46
|
+
- ".worktreeinclude"
|
|
46
47
|
- CHANGELOG.md
|
|
47
48
|
- CLAUDE.md
|
|
48
49
|
- LICENSE.txt
|