claude_agent 0.7.7 → 0.7.9
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 +65 -0
- data/README.md +551 -37
- data/SPEC.md +70 -30
- data/lib/claude_agent/client.rb +197 -7
- data/lib/claude_agent/content_blocks.rb +193 -5
- data/lib/claude_agent/control_protocol.rb +111 -11
- data/lib/claude_agent/conversation.rb +248 -0
- data/lib/claude_agent/cumulative_usage.rb +106 -0
- data/lib/claude_agent/event_handler.rb +152 -0
- data/lib/claude_agent/hooks.rb +106 -225
- data/lib/claude_agent/list_sessions.rb +508 -0
- data/lib/claude_agent/mcp/server.rb +3 -3
- data/lib/claude_agent/mcp/tool.rb +4 -4
- data/lib/claude_agent/message_parser.rb +201 -185
- data/lib/claude_agent/messages.rb +86 -13
- data/lib/claude_agent/options.rb +5 -4
- data/lib/claude_agent/permission_queue.rb +87 -0
- data/lib/claude_agent/permission_request.rb +151 -0
- data/lib/claude_agent/permissions.rb +4 -2
- data/lib/claude_agent/query.rb +34 -0
- data/lib/claude_agent/tool_activity.rb +78 -0
- data/lib/claude_agent/turn_result.rb +239 -0
- data/lib/claude_agent/types.rb +29 -0
- data/lib/claude_agent/version.rb +1 -1
- data/lib/claude_agent.rb +39 -1
- data/sig/claude_agent.rbs +285 -4
- metadata +9 -1
data/sig/claude_agent.rbs
CHANGED
|
@@ -30,6 +30,20 @@ module ClaudeAgent
|
|
|
30
30
|
?transport: Transport::Base?
|
|
31
31
|
) -> Enumerator[message, void]
|
|
32
32
|
|
|
33
|
+
# One-shot query returning a TurnResult
|
|
34
|
+
def self.query_turn: (
|
|
35
|
+
prompt: String,
|
|
36
|
+
?options: Options?,
|
|
37
|
+
?transport: Transport::Base?,
|
|
38
|
+
?events: EventHandler?
|
|
39
|
+
) -> TurnResult
|
|
40
|
+
| (
|
|
41
|
+
prompt: String,
|
|
42
|
+
?options: Options?,
|
|
43
|
+
?transport: Transport::Base?,
|
|
44
|
+
?events: EventHandler?
|
|
45
|
+
) { (message) -> void } -> TurnResult
|
|
46
|
+
|
|
33
47
|
# Error classes
|
|
34
48
|
class Error < StandardError
|
|
35
49
|
end
|
|
@@ -187,6 +201,20 @@ module ClaudeAgent
|
|
|
187
201
|
def initialize: (can_rewind: bool, ?error: String?, ?files_changed: Array[String]?, ?insertions: Integer?, ?deletions: Integer?) -> void
|
|
188
202
|
end
|
|
189
203
|
|
|
204
|
+
# Session metadata returned by list_sessions (TypeScript SDK parity: SDKSessionInfo)
|
|
205
|
+
class SessionInfo
|
|
206
|
+
attr_reader session_id: String
|
|
207
|
+
attr_reader summary: String
|
|
208
|
+
attr_reader last_modified: Integer
|
|
209
|
+
attr_reader file_size: Integer
|
|
210
|
+
attr_reader custom_title: String?
|
|
211
|
+
attr_reader first_prompt: String?
|
|
212
|
+
attr_reader git_branch: String?
|
|
213
|
+
attr_reader cwd: String?
|
|
214
|
+
|
|
215
|
+
def initialize: (session_id: String, summary: String, last_modified: Integer, file_size: Integer, ?custom_title: String?, ?first_prompt: String?, ?git_branch: String?, ?cwd: String?) -> void
|
|
216
|
+
end
|
|
217
|
+
|
|
190
218
|
# Agent definition for custom subagents (TypeScript SDK parity)
|
|
191
219
|
class AgentDefinition
|
|
192
220
|
attr_reader description: String
|
|
@@ -292,6 +320,7 @@ module ClaudeAgent
|
|
|
292
320
|
attr_accessor permission_prompt_tool_name: String?
|
|
293
321
|
attr_accessor can_use_tool: (^(String, Hash[String, untyped], untyped) -> permission_result)?
|
|
294
322
|
attr_accessor allow_dangerously_skip_permissions: bool
|
|
323
|
+
attr_accessor permission_queue: bool?
|
|
295
324
|
|
|
296
325
|
# Conversation flow
|
|
297
326
|
attr_accessor continue_conversation: bool
|
|
@@ -398,6 +427,9 @@ module ClaudeAgent
|
|
|
398
427
|
def initialize: (id: String, name: String, input: Hash[String, untyped]) -> void
|
|
399
428
|
def type: () -> :tool_use
|
|
400
429
|
def to_h: () -> Hash[Symbol, untyped]
|
|
430
|
+
def file_path: () -> String?
|
|
431
|
+
def display_label: () -> String
|
|
432
|
+
def summary: (?max: Integer) -> String
|
|
401
433
|
end
|
|
402
434
|
|
|
403
435
|
class ToolResultBlock
|
|
@@ -419,6 +451,9 @@ module ClaudeAgent
|
|
|
419
451
|
def initialize: (id: String, name: String, input: Hash[String, untyped], server_name: String) -> void
|
|
420
452
|
def type: () -> :server_tool_use
|
|
421
453
|
def to_h: () -> Hash[Symbol, untyped]
|
|
454
|
+
def file_path: () -> String?
|
|
455
|
+
def display_label: () -> String
|
|
456
|
+
def summary: (?max: Integer) -> String
|
|
422
457
|
end
|
|
423
458
|
|
|
424
459
|
class ServerToolResultBlock
|
|
@@ -444,12 +479,32 @@ module ClaudeAgent
|
|
|
444
479
|
def to_h: () -> Hash[Symbol, untyped]
|
|
445
480
|
end
|
|
446
481
|
|
|
447
|
-
|
|
482
|
+
class GenericBlock
|
|
483
|
+
attr_reader block_type: String?
|
|
484
|
+
attr_reader raw: Hash[Symbol, untyped]
|
|
485
|
+
|
|
486
|
+
def initialize: (block_type: String?, raw: Hash[Symbol, untyped]) -> void
|
|
487
|
+
def type: () -> Symbol
|
|
488
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
489
|
+
def []: (Symbol key) -> untyped
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
type content_block = TextBlock | ThinkingBlock | ToolUseBlock | ToolResultBlock | ServerToolUseBlock | ServerToolResultBlock | ImageContentBlock | GenericBlock
|
|
448
493
|
|
|
449
494
|
CONTENT_BLOCK_TYPES: Array[Class]
|
|
450
495
|
|
|
496
|
+
class GenericMessage
|
|
497
|
+
attr_reader message_type: String?
|
|
498
|
+
attr_reader raw: Hash[Symbol, untyped]
|
|
499
|
+
|
|
500
|
+
def initialize: (message_type: String?, raw: Hash[Symbol, untyped]) -> void
|
|
501
|
+
def type: () -> Symbol
|
|
502
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
503
|
+
def []: (Symbol key) -> untyped
|
|
504
|
+
end
|
|
505
|
+
|
|
451
506
|
# Message types
|
|
452
|
-
type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent | TaskStartedMessage | RateLimitEvent | PromptSuggestionMessage
|
|
507
|
+
type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent | TaskStartedMessage | TaskProgressMessage | RateLimitEvent | PromptSuggestionMessage | GenericMessage
|
|
453
508
|
|
|
454
509
|
MESSAGE_TYPES: Array[Class]
|
|
455
510
|
|
|
@@ -699,6 +754,20 @@ module ClaudeAgent
|
|
|
699
754
|
def type: () -> :task_started
|
|
700
755
|
end
|
|
701
756
|
|
|
757
|
+
# Task progress message (TypeScript SDK v0.2.51 parity)
|
|
758
|
+
class TaskProgressMessage
|
|
759
|
+
attr_reader uuid: String
|
|
760
|
+
attr_reader session_id: String
|
|
761
|
+
attr_reader task_id: String
|
|
762
|
+
attr_reader tool_use_id: String?
|
|
763
|
+
attr_reader description: String
|
|
764
|
+
attr_reader usage: Hash[String, untyped]?
|
|
765
|
+
attr_reader last_tool_name: String?
|
|
766
|
+
|
|
767
|
+
def initialize: (uuid: String, session_id: String, task_id: String, description: String, ?usage: Hash[String, untyped]?, ?tool_use_id: String?, ?last_tool_name: String?) -> void
|
|
768
|
+
def type: () -> :task_progress
|
|
769
|
+
end
|
|
770
|
+
|
|
702
771
|
# Rate limit event (TypeScript SDK v0.2.45 parity)
|
|
703
772
|
class RateLimitEvent
|
|
704
773
|
attr_reader rate_limit_info: Hash[String, untyped]
|
|
@@ -723,7 +792,10 @@ module ClaudeAgent
|
|
|
723
792
|
# Message parser
|
|
724
793
|
class MessageParser
|
|
725
794
|
def initialize: (?logger: Logger?) -> void
|
|
726
|
-
def parse: (Hash[
|
|
795
|
+
def parse: (Hash[untyped, untyped] raw) -> message
|
|
796
|
+
|
|
797
|
+
def self.registry: () -> Hash[String, Symbol]
|
|
798
|
+
def self.register: (String key, Symbol method_name) -> void
|
|
727
799
|
end
|
|
728
800
|
|
|
729
801
|
# Hook types
|
|
@@ -752,6 +824,9 @@ module ClaudeAgent
|
|
|
752
824
|
attr_reader permission_mode: String?
|
|
753
825
|
|
|
754
826
|
def initialize: (hook_event_name: String, ?session_id: String?, ?transcript_path: String?, ?cwd: String?, ?permission_mode: String?, **untyped) -> void
|
|
827
|
+
|
|
828
|
+
def self.define_input: (String event_name, ?required: Array[Symbol], ?optional: Hash[Symbol, untyped], ?constants: Hash[Symbol, untyped]) -> Class
|
|
829
|
+
| (String event_name, ?required: Array[Symbol], ?optional: Hash[Symbol, untyped], ?constants: Hash[Symbol, untyped]) { () -> void } -> Class
|
|
755
830
|
end
|
|
756
831
|
|
|
757
832
|
class PreToolUseInput < BaseHookInput
|
|
@@ -879,6 +954,18 @@ module ClaudeAgent
|
|
|
879
954
|
def initialize: (source: String, ?file_path: String?, **untyped) -> void
|
|
880
955
|
end
|
|
881
956
|
|
|
957
|
+
class WorktreeCreateInput < BaseHookInput
|
|
958
|
+
attr_reader name: String
|
|
959
|
+
|
|
960
|
+
def initialize: (name: String, **untyped) -> void
|
|
961
|
+
end
|
|
962
|
+
|
|
963
|
+
class WorktreeRemoveInput < BaseHookInput
|
|
964
|
+
attr_reader worktree_path: String
|
|
965
|
+
|
|
966
|
+
def initialize: (worktree_path: String, **untyped) -> void
|
|
967
|
+
end
|
|
968
|
+
|
|
882
969
|
# Permission types
|
|
883
970
|
type permission_result = PermissionResultAllow | PermissionResultDeny
|
|
884
971
|
|
|
@@ -933,15 +1020,189 @@ module ClaudeAgent
|
|
|
933
1020
|
attr_reader agent_id: String?
|
|
934
1021
|
attr_reader signal: AbortSignal?
|
|
935
1022
|
attr_reader description: String?
|
|
1023
|
+
attr_reader request: PermissionRequest?
|
|
936
1024
|
|
|
937
|
-
def initialize: (?permission_suggestions: untyped, ?blocked_path: String?, ?decision_reason: String?, ?tool_use_id: String?, ?agent_id: String?, ?signal: AbortSignal?, ?description: String?) -> void
|
|
1025
|
+
def initialize: (?permission_suggestions: untyped, ?blocked_path: String?, ?decision_reason: String?, ?tool_use_id: String?, ?agent_id: String?, ?signal: AbortSignal?, ?description: String?, ?request: PermissionRequest?) -> void
|
|
938
1026
|
end
|
|
939
1027
|
|
|
1028
|
+
# Deferred permission request resolved from any thread
|
|
1029
|
+
class PermissionRequest
|
|
1030
|
+
attr_reader tool_name: String
|
|
1031
|
+
attr_reader input: Hash[Symbol, untyped]
|
|
1032
|
+
attr_reader context: ToolPermissionContext?
|
|
1033
|
+
attr_reader request_id: String
|
|
1034
|
+
attr_reader created_at: Time
|
|
1035
|
+
|
|
1036
|
+
def initialize: (tool_name: String, input: Hash[Symbol, untyped], context: ToolPermissionContext?, request_id: String) -> void
|
|
1037
|
+
def allow!: (?updated_input: Hash[Symbol, untyped]?, ?updated_permissions: Array[PermissionUpdate]?) -> void
|
|
1038
|
+
def deny!: (?message: String, ?interrupt: bool) -> void
|
|
1039
|
+
def defer!: () -> self
|
|
1040
|
+
def deferred?: () -> bool
|
|
1041
|
+
def resolved?: () -> bool
|
|
1042
|
+
def pending?: () -> bool
|
|
1043
|
+
def result: () -> permission_result?
|
|
1044
|
+
def wait: (?timeout: Numeric?) -> permission_result
|
|
1045
|
+
def inspect: () -> String
|
|
1046
|
+
end
|
|
1047
|
+
|
|
1048
|
+
# Thread-safe queue of pending permission requests
|
|
1049
|
+
class PermissionQueue
|
|
1050
|
+
def initialize: () -> void
|
|
1051
|
+
def poll: () -> PermissionRequest?
|
|
1052
|
+
def pop: (?timeout: Numeric?) -> PermissionRequest?
|
|
1053
|
+
def empty?: () -> bool
|
|
1054
|
+
def size: () -> Integer
|
|
1055
|
+
def push: (PermissionRequest request) -> void
|
|
1056
|
+
def drain!: (?reason: String) -> Array[PermissionRequest]
|
|
1057
|
+
end
|
|
1058
|
+
|
|
1059
|
+
# Cumulative usage tracking across conversation turns
|
|
1060
|
+
class CumulativeUsage
|
|
1061
|
+
attr_reader input_tokens: Integer
|
|
1062
|
+
attr_reader output_tokens: Integer
|
|
1063
|
+
attr_reader cache_read_input_tokens: Integer
|
|
1064
|
+
attr_reader cache_creation_input_tokens: Integer
|
|
1065
|
+
attr_reader total_cost_usd: Float
|
|
1066
|
+
attr_reader num_turns: Integer
|
|
1067
|
+
attr_reader duration_ms: Integer
|
|
1068
|
+
attr_reader duration_api_ms: Integer
|
|
1069
|
+
|
|
1070
|
+
def initialize: () -> void
|
|
1071
|
+
def track: (untyped message) -> void
|
|
1072
|
+
def reset!: () -> void
|
|
1073
|
+
def to_h: () -> Hash[Symbol, Integer | Float]
|
|
1074
|
+
end
|
|
1075
|
+
|
|
1076
|
+
# Represents a complete agent turn
|
|
1077
|
+
class TurnResult
|
|
1078
|
+
attr_reader messages: Array[message]
|
|
1079
|
+
|
|
1080
|
+
def initialize: () -> void
|
|
1081
|
+
def <<: (message) -> self
|
|
1082
|
+
def result: () -> ResultMessage?
|
|
1083
|
+
def complete?: () -> bool
|
|
1084
|
+
|
|
1085
|
+
# Text & thinking
|
|
1086
|
+
def text: () -> String
|
|
1087
|
+
def thinking: () -> String
|
|
1088
|
+
|
|
1089
|
+
# Tool use
|
|
1090
|
+
def tool_uses: () -> Array[ToolUseBlock | ServerToolUseBlock]
|
|
1091
|
+
def tool_results: () -> Array[ToolResultBlock | ServerToolResultBlock]
|
|
1092
|
+
def tool_executions: () -> Array[Hash[Symbol, ToolUseBlock | ServerToolUseBlock | ToolResultBlock | ServerToolResultBlock | nil]]
|
|
1093
|
+
|
|
1094
|
+
# Result accessors
|
|
1095
|
+
def usage: () -> Hash[Symbol, Integer]?
|
|
1096
|
+
def cost: () -> Float?
|
|
1097
|
+
def duration_ms: () -> Integer?
|
|
1098
|
+
def duration_api_ms: () -> Integer?
|
|
1099
|
+
def session_id: () -> String?
|
|
1100
|
+
def num_turns: () -> Integer?
|
|
1101
|
+
def stop_reason: () -> String?
|
|
1102
|
+
def model: () -> String?
|
|
1103
|
+
def model_usage: () -> Hash[String, untyped]?
|
|
1104
|
+
def structured_output: () -> untyped
|
|
1105
|
+
def permission_denials: () -> Array[SDKPermissionDenial]
|
|
1106
|
+
def errors: () -> Array[String]
|
|
1107
|
+
|
|
1108
|
+
# Status
|
|
1109
|
+
def success?: () -> bool
|
|
1110
|
+
def error?: () -> bool
|
|
1111
|
+
def subtype: () -> String?
|
|
1112
|
+
|
|
1113
|
+
# Filtered message access
|
|
1114
|
+
def assistant_messages: () -> Array[AssistantMessage]
|
|
1115
|
+
def user_messages: () -> Array[UserMessage | UserMessageReplay]
|
|
1116
|
+
def stream_events: () -> Array[StreamEvent]
|
|
1117
|
+
def content_blocks: () -> Array[content_block]
|
|
1118
|
+
|
|
1119
|
+
def inspect: () -> String
|
|
1120
|
+
end
|
|
1121
|
+
|
|
1122
|
+
# Event handler for dispatching typed events from message streams
|
|
1123
|
+
class EventHandler
|
|
1124
|
+
def initialize: () -> void
|
|
1125
|
+
def on: (Symbol event) { (*untyped) -> void } -> self
|
|
1126
|
+
def on_message: () { (message) -> void } -> self
|
|
1127
|
+
def on_text: () { (String) -> void } -> self
|
|
1128
|
+
def on_thinking: () { (String) -> void } -> self
|
|
1129
|
+
def on_tool_use: () { (ToolUseBlock | ServerToolUseBlock) -> void } -> self
|
|
1130
|
+
def on_tool_result: () { (ToolResultBlock | ServerToolResultBlock, (ToolUseBlock | ServerToolUseBlock)?) -> void } -> self
|
|
1131
|
+
def on_result: () { (ResultMessage) -> void } -> self
|
|
1132
|
+
def handle: (message) -> void
|
|
1133
|
+
def reset!: () -> void
|
|
1134
|
+
def has_handlers?: () -> bool
|
|
1135
|
+
end
|
|
1136
|
+
|
|
1137
|
+
# A single tool execution in the conversation timeline
|
|
1138
|
+
class ToolActivity
|
|
1139
|
+
attr_reader tool_use: ToolUseBlock | ServerToolUseBlock
|
|
1140
|
+
attr_reader tool_result: ToolResultBlock | ServerToolResultBlock | nil
|
|
1141
|
+
attr_reader turn_index: Integer
|
|
1142
|
+
attr_reader started_at: Time?
|
|
1143
|
+
attr_reader completed_at: Time?
|
|
1144
|
+
|
|
1145
|
+
def initialize: (tool_use: ToolUseBlock | ServerToolUseBlock, ?tool_result: ToolResultBlock | ServerToolResultBlock | nil, turn_index: Integer, ?started_at: Time?, ?completed_at: Time?) -> void
|
|
1146
|
+
def name: () -> String
|
|
1147
|
+
def display_label: () -> String
|
|
1148
|
+
def summary: (?max: Integer) -> String
|
|
1149
|
+
def file_path: () -> String?
|
|
1150
|
+
def id: () -> String
|
|
1151
|
+
def error?: () -> bool
|
|
1152
|
+
def complete?: () -> bool
|
|
1153
|
+
def duration: () -> Float?
|
|
1154
|
+
end
|
|
1155
|
+
|
|
1156
|
+
# High-level conversation interface managing the full lifecycle
|
|
1157
|
+
class Conversation
|
|
1158
|
+
CONVERSATION_KEYS: Array[Symbol]
|
|
1159
|
+
|
|
1160
|
+
attr_reader turns: Array[TurnResult]
|
|
1161
|
+
attr_reader messages: Array[message]
|
|
1162
|
+
attr_reader tool_activity: Array[ToolActivity]
|
|
1163
|
+
attr_reader client: Client
|
|
1164
|
+
|
|
1165
|
+
def self.open: (**untyped) { (Conversation) -> void } -> void
|
|
1166
|
+
def self.resume: (String session_id, **untyped) -> Conversation
|
|
1167
|
+
|
|
1168
|
+
def initialize: (**untyped) -> void
|
|
1169
|
+
def say: (String | Array[content_block] prompt) -> TurnResult
|
|
1170
|
+
| (String | Array[content_block] prompt) { (message) -> void } -> TurnResult
|
|
1171
|
+
def total_cost: () -> Float
|
|
1172
|
+
def session_id: () -> String?
|
|
1173
|
+
def usage: () -> CumulativeUsage
|
|
1174
|
+
def pending_permission: () -> PermissionRequest?
|
|
1175
|
+
def pending_permissions?: () -> bool
|
|
1176
|
+
def close: () -> void
|
|
1177
|
+
def open?: () -> bool
|
|
1178
|
+
def closed?: () -> bool
|
|
1179
|
+
def inspect: () -> String
|
|
1180
|
+
end
|
|
1181
|
+
|
|
1182
|
+
# Session discovery
|
|
1183
|
+
def self.list_sessions: (?dir: String?, ?limit: Integer?) -> Array[SessionInfo]
|
|
1184
|
+
|
|
1185
|
+
# ListSessions module
|
|
1186
|
+
module ListSessions
|
|
1187
|
+
MAX_SLUG_LENGTH: Integer
|
|
1188
|
+
BUFFER_SIZE: Integer
|
|
1189
|
+
UUID_PATTERN: Regexp
|
|
1190
|
+
|
|
1191
|
+
def self.call: (?dir: String?, ?limit: Integer?) -> Array[SessionInfo]
|
|
1192
|
+
end
|
|
1193
|
+
|
|
1194
|
+
# Convenience methods
|
|
1195
|
+
def self.conversation: (**untyped) -> Conversation
|
|
1196
|
+
def self.resume_conversation: (String session_id, **untyped) -> Conversation
|
|
1197
|
+
|
|
940
1198
|
# Client
|
|
941
1199
|
class Client
|
|
942
1200
|
attr_reader options: Options
|
|
943
1201
|
attr_reader transport: Transport::Base
|
|
944
1202
|
attr_reader server_info: Hash[String, untyped]?
|
|
1203
|
+
attr_reader cumulative_usage: CumulativeUsage
|
|
1204
|
+
attr_reader event_handler: EventHandler
|
|
1205
|
+
attr_reader permission_queue: PermissionQueue
|
|
945
1206
|
|
|
946
1207
|
def self.open: (?options: Options?, ?transport: Transport::Base?, ?prompt: String?) { (Client) -> void } -> void
|
|
947
1208
|
|
|
@@ -951,10 +1212,21 @@ module ClaudeAgent
|
|
|
951
1212
|
def connected?: () -> bool
|
|
952
1213
|
def send_message: (String | Array[content_block] content, ?session_id: String, ?uuid: String?) -> void
|
|
953
1214
|
alias query send_message
|
|
1215
|
+
def on: (Symbol event) { (*untyped) -> void } -> self
|
|
1216
|
+
def on_message: () { (message) -> void } -> self
|
|
1217
|
+
def on_text: () { (String) -> void } -> self
|
|
1218
|
+
def on_thinking: () { (String) -> void } -> self
|
|
1219
|
+
def on_tool_use: () { (ToolUseBlock | ServerToolUseBlock) -> void } -> self
|
|
1220
|
+
def on_tool_result: () { (ToolResultBlock | ServerToolResultBlock, (ToolUseBlock | ServerToolUseBlock)?) -> void } -> self
|
|
1221
|
+
def on_result: () { (ResultMessage) -> void } -> self
|
|
954
1222
|
def receive_messages: () { (message) -> void } -> void
|
|
955
1223
|
| () -> Enumerator[message, void]
|
|
956
1224
|
def receive_response: () { (message) -> void } -> void
|
|
957
1225
|
| () -> Enumerator[message, void]
|
|
1226
|
+
def receive_turn: () -> TurnResult
|
|
1227
|
+
| () { (message) -> void } -> TurnResult
|
|
1228
|
+
def send_and_receive: (String | Array[content_block] content, ?session_id: String, ?uuid: String?) -> TurnResult
|
|
1229
|
+
| (String | Array[content_block] content, ?session_id: String, ?uuid: String?) { (message) -> void } -> TurnResult
|
|
958
1230
|
def stream_input: (Enumerable[String | Hash[String, untyped] | UserMessage] stream, ?session_id: String) -> void
|
|
959
1231
|
| (Enumerable[String | Hash[String, untyped] | UserMessage] stream, ?session_id: String) { (message) -> void } -> void
|
|
960
1232
|
def interrupt: () -> void
|
|
@@ -966,12 +1238,17 @@ module ClaudeAgent
|
|
|
966
1238
|
def set_mcp_servers: (Hash[String, untyped] servers) -> McpSetServersResult
|
|
967
1239
|
def mcp_reconnect: (String server_name) -> Hash[String, untyped]
|
|
968
1240
|
def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
|
|
1241
|
+
def mcp_authenticate: (String server_name) -> Hash[String, untyped]
|
|
1242
|
+
def mcp_clear_auth: (String server_name) -> Hash[String, untyped]
|
|
969
1243
|
def stop_task: (String task_id) -> Hash[String, untyped]
|
|
1244
|
+
def apply_flag_settings: (Hash[String, untyped] settings) -> Hash[String, untyped]
|
|
970
1245
|
def supported_commands: () -> Array[SlashCommand]
|
|
971
1246
|
def supported_models: () -> Array[ModelInfo]
|
|
972
1247
|
def mcp_server_status: () -> Array[McpServerStatus]
|
|
973
1248
|
def account_info: () -> AccountInfo
|
|
974
1249
|
def initialization_result: () -> InitializationResult
|
|
1250
|
+
def pending_permission: () -> PermissionRequest?
|
|
1251
|
+
def pending_permissions?: () -> bool
|
|
975
1252
|
end
|
|
976
1253
|
|
|
977
1254
|
# Control protocol
|
|
@@ -983,6 +1260,7 @@ module ClaudeAgent
|
|
|
983
1260
|
attr_reader transport: Transport::Base
|
|
984
1261
|
attr_reader options: Options
|
|
985
1262
|
attr_reader server_info: Hash[String, untyped]?
|
|
1263
|
+
attr_accessor permission_queue: PermissionQueue?
|
|
986
1264
|
|
|
987
1265
|
def initialize: (transport: Transport::Base, ?options: Options?) -> void
|
|
988
1266
|
def start: (?streaming: bool, ?prompt: String?) -> Hash[String, untyped]?
|
|
@@ -1003,7 +1281,10 @@ module ClaudeAgent
|
|
|
1003
1281
|
def set_mcp_servers: (Hash[String, untyped] servers) -> McpSetServersResult
|
|
1004
1282
|
def mcp_reconnect: (String server_name) -> Hash[String, untyped]
|
|
1005
1283
|
def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
|
|
1284
|
+
def mcp_authenticate: (String server_name) -> Hash[String, untyped]
|
|
1285
|
+
def mcp_clear_auth: (String server_name) -> Hash[String, untyped]
|
|
1006
1286
|
def stop_task: (String task_id) -> Hash[String, untyped]
|
|
1287
|
+
def apply_flag_settings: (Hash[String, untyped] settings) -> Hash[String, untyped]
|
|
1007
1288
|
def supported_commands: () -> Array[SlashCommand]
|
|
1008
1289
|
def supported_models: () -> Array[ModelInfo]
|
|
1009
1290
|
def mcp_server_status: () -> Array[McpServerStatus]
|
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.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Carr
|
|
@@ -55,21 +55,29 @@ files:
|
|
|
55
55
|
- lib/claude_agent/client.rb
|
|
56
56
|
- lib/claude_agent/content_blocks.rb
|
|
57
57
|
- lib/claude_agent/control_protocol.rb
|
|
58
|
+
- lib/claude_agent/conversation.rb
|
|
59
|
+
- lib/claude_agent/cumulative_usage.rb
|
|
58
60
|
- lib/claude_agent/errors.rb
|
|
61
|
+
- lib/claude_agent/event_handler.rb
|
|
59
62
|
- lib/claude_agent/hooks.rb
|
|
63
|
+
- lib/claude_agent/list_sessions.rb
|
|
60
64
|
- lib/claude_agent/logging.rb
|
|
61
65
|
- lib/claude_agent/mcp/server.rb
|
|
62
66
|
- lib/claude_agent/mcp/tool.rb
|
|
63
67
|
- lib/claude_agent/message_parser.rb
|
|
64
68
|
- lib/claude_agent/messages.rb
|
|
65
69
|
- lib/claude_agent/options.rb
|
|
70
|
+
- lib/claude_agent/permission_queue.rb
|
|
71
|
+
- lib/claude_agent/permission_request.rb
|
|
66
72
|
- lib/claude_agent/permissions.rb
|
|
67
73
|
- lib/claude_agent/query.rb
|
|
68
74
|
- lib/claude_agent/sandbox_settings.rb
|
|
69
75
|
- lib/claude_agent/session.rb
|
|
70
76
|
- lib/claude_agent/spawn.rb
|
|
77
|
+
- lib/claude_agent/tool_activity.rb
|
|
71
78
|
- lib/claude_agent/transport/base.rb
|
|
72
79
|
- lib/claude_agent/transport/subprocess.rb
|
|
80
|
+
- lib/claude_agent/turn_result.rb
|
|
73
81
|
- lib/claude_agent/types.rb
|
|
74
82
|
- lib/claude_agent/version.rb
|
|
75
83
|
- sig/claude_agent.rbs
|