claude_agent 0.7.8 → 0.7.10
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 +73 -0
- data/README.md +603 -47
- data/SPEC.md +92 -28
- data/lib/claude_agent/client.rb +181 -7
- data/lib/claude_agent/content_blocks.rb +193 -5
- data/lib/claude_agent/control_protocol.rb +97 -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/get_session_messages.rb +236 -0
- data/lib/claude_agent/hooks.rb +104 -253
- data/lib/claude_agent/list_sessions.rb +398 -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/session.rb +71 -3
- data/lib/claude_agent/session_message_relation.rb +59 -0
- data/lib/claude_agent/session_paths.rb +120 -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 +45 -0
- data/lib/claude_agent/version.rb +1 -1
- data/lib/claude_agent.rb +58 -2
- data/sig/claude_agent.rbs +336 -7
- metadata +12 -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,31 @@ 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
|
+
|
|
218
|
+
# Session transcript message returned by get_session_messages (TypeScript SDK v0.2.59 parity)
|
|
219
|
+
class SessionMessage
|
|
220
|
+
attr_reader type: String
|
|
221
|
+
attr_reader uuid: String
|
|
222
|
+
attr_reader session_id: String
|
|
223
|
+
attr_reader message: untyped
|
|
224
|
+
attr_reader parent_tool_use_id: nil
|
|
225
|
+
|
|
226
|
+
def initialize: (type: String, uuid: String, session_id: String, message: untyped, ?parent_tool_use_id: nil) -> void
|
|
227
|
+
end
|
|
228
|
+
|
|
190
229
|
# Agent definition for custom subagents (TypeScript SDK parity)
|
|
191
230
|
class AgentDefinition
|
|
192
231
|
attr_reader description: String
|
|
@@ -292,6 +331,7 @@ module ClaudeAgent
|
|
|
292
331
|
attr_accessor permission_prompt_tool_name: String?
|
|
293
332
|
attr_accessor can_use_tool: (^(String, Hash[String, untyped], untyped) -> permission_result)?
|
|
294
333
|
attr_accessor allow_dangerously_skip_permissions: bool
|
|
334
|
+
attr_accessor permission_queue: bool?
|
|
295
335
|
|
|
296
336
|
# Conversation flow
|
|
297
337
|
attr_accessor continue_conversation: bool
|
|
@@ -398,6 +438,9 @@ module ClaudeAgent
|
|
|
398
438
|
def initialize: (id: String, name: String, input: Hash[String, untyped]) -> void
|
|
399
439
|
def type: () -> :tool_use
|
|
400
440
|
def to_h: () -> Hash[Symbol, untyped]
|
|
441
|
+
def file_path: () -> String?
|
|
442
|
+
def display_label: () -> String
|
|
443
|
+
def summary: (?max: Integer) -> String
|
|
401
444
|
end
|
|
402
445
|
|
|
403
446
|
class ToolResultBlock
|
|
@@ -419,6 +462,9 @@ module ClaudeAgent
|
|
|
419
462
|
def initialize: (id: String, name: String, input: Hash[String, untyped], server_name: String) -> void
|
|
420
463
|
def type: () -> :server_tool_use
|
|
421
464
|
def to_h: () -> Hash[Symbol, untyped]
|
|
465
|
+
def file_path: () -> String?
|
|
466
|
+
def display_label: () -> String
|
|
467
|
+
def summary: (?max: Integer) -> String
|
|
422
468
|
end
|
|
423
469
|
|
|
424
470
|
class ServerToolResultBlock
|
|
@@ -444,12 +490,32 @@ module ClaudeAgent
|
|
|
444
490
|
def to_h: () -> Hash[Symbol, untyped]
|
|
445
491
|
end
|
|
446
492
|
|
|
447
|
-
|
|
493
|
+
class GenericBlock
|
|
494
|
+
attr_reader block_type: String?
|
|
495
|
+
attr_reader raw: Hash[Symbol, untyped]
|
|
496
|
+
|
|
497
|
+
def initialize: (block_type: String?, raw: Hash[Symbol, untyped]) -> void
|
|
498
|
+
def type: () -> Symbol
|
|
499
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
500
|
+
def []: (Symbol key) -> untyped
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
type content_block = TextBlock | ThinkingBlock | ToolUseBlock | ToolResultBlock | ServerToolUseBlock | ServerToolResultBlock | ImageContentBlock | GenericBlock
|
|
448
504
|
|
|
449
505
|
CONTENT_BLOCK_TYPES: Array[Class]
|
|
450
506
|
|
|
507
|
+
class GenericMessage
|
|
508
|
+
attr_reader message_type: String?
|
|
509
|
+
attr_reader raw: Hash[Symbol, untyped]
|
|
510
|
+
|
|
511
|
+
def initialize: (message_type: String?, raw: Hash[Symbol, untyped]) -> void
|
|
512
|
+
def type: () -> Symbol
|
|
513
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
514
|
+
def []: (Symbol key) -> untyped
|
|
515
|
+
end
|
|
516
|
+
|
|
451
517
|
# Message types
|
|
452
|
-
type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent | TaskStartedMessage | RateLimitEvent | PromptSuggestionMessage
|
|
518
|
+
type message = UserMessage | UserMessageReplay | AssistantMessage | SystemMessage | ResultMessage | StreamEvent | CompactBoundaryMessage | StatusMessage | ToolProgressMessage | HookResponseMessage | AuthStatusMessage | TaskNotificationMessage | HookStartedMessage | HookProgressMessage | ToolUseSummaryMessage | FilesPersistedEvent | TaskStartedMessage | TaskProgressMessage | RateLimitEvent | PromptSuggestionMessage | GenericMessage
|
|
453
519
|
|
|
454
520
|
MESSAGE_TYPES: Array[Class]
|
|
455
521
|
|
|
@@ -699,6 +765,20 @@ module ClaudeAgent
|
|
|
699
765
|
def type: () -> :task_started
|
|
700
766
|
end
|
|
701
767
|
|
|
768
|
+
# Task progress message (TypeScript SDK v0.2.51 parity)
|
|
769
|
+
class TaskProgressMessage
|
|
770
|
+
attr_reader uuid: String
|
|
771
|
+
attr_reader session_id: String
|
|
772
|
+
attr_reader task_id: String
|
|
773
|
+
attr_reader tool_use_id: String?
|
|
774
|
+
attr_reader description: String
|
|
775
|
+
attr_reader usage: Hash[String, untyped]?
|
|
776
|
+
attr_reader last_tool_name: String?
|
|
777
|
+
|
|
778
|
+
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
|
|
779
|
+
def type: () -> :task_progress
|
|
780
|
+
end
|
|
781
|
+
|
|
702
782
|
# Rate limit event (TypeScript SDK v0.2.45 parity)
|
|
703
783
|
class RateLimitEvent
|
|
704
784
|
attr_reader rate_limit_info: Hash[String, untyped]
|
|
@@ -723,7 +803,10 @@ module ClaudeAgent
|
|
|
723
803
|
# Message parser
|
|
724
804
|
class MessageParser
|
|
725
805
|
def initialize: (?logger: Logger?) -> void
|
|
726
|
-
def parse: (Hash[
|
|
806
|
+
def parse: (Hash[untyped, untyped] raw) -> message
|
|
807
|
+
|
|
808
|
+
def self.registry: () -> Hash[String, Symbol]
|
|
809
|
+
def self.register: (String key, Symbol method_name) -> void
|
|
727
810
|
end
|
|
728
811
|
|
|
729
812
|
# Hook types
|
|
@@ -752,6 +835,9 @@ module ClaudeAgent
|
|
|
752
835
|
attr_reader permission_mode: String?
|
|
753
836
|
|
|
754
837
|
def initialize: (hook_event_name: String, ?session_id: String?, ?transcript_path: String?, ?cwd: String?, ?permission_mode: String?, **untyped) -> void
|
|
838
|
+
|
|
839
|
+
def self.define_input: (String event_name, ?required: Array[Symbol], ?optional: Hash[Symbol, untyped], ?constants: Hash[Symbol, untyped]) -> Class
|
|
840
|
+
| (String event_name, ?required: Array[Symbol], ?optional: Hash[Symbol, untyped], ?constants: Hash[Symbol, untyped]) { () -> void } -> Class
|
|
755
841
|
end
|
|
756
842
|
|
|
757
843
|
class PreToolUseInput < BaseHookInput
|
|
@@ -945,15 +1031,210 @@ module ClaudeAgent
|
|
|
945
1031
|
attr_reader agent_id: String?
|
|
946
1032
|
attr_reader signal: AbortSignal?
|
|
947
1033
|
attr_reader description: String?
|
|
1034
|
+
attr_reader request: PermissionRequest?
|
|
1035
|
+
|
|
1036
|
+
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
|
|
1037
|
+
end
|
|
1038
|
+
|
|
1039
|
+
# Deferred permission request resolved from any thread
|
|
1040
|
+
class PermissionRequest
|
|
1041
|
+
attr_reader tool_name: String
|
|
1042
|
+
attr_reader input: Hash[Symbol, untyped]
|
|
1043
|
+
attr_reader context: ToolPermissionContext?
|
|
1044
|
+
attr_reader request_id: String
|
|
1045
|
+
attr_reader created_at: Time
|
|
1046
|
+
|
|
1047
|
+
def initialize: (tool_name: String, input: Hash[Symbol, untyped], context: ToolPermissionContext?, request_id: String) -> void
|
|
1048
|
+
def allow!: (?updated_input: Hash[Symbol, untyped]?, ?updated_permissions: Array[PermissionUpdate]?) -> void
|
|
1049
|
+
def deny!: (?message: String, ?interrupt: bool) -> void
|
|
1050
|
+
def defer!: () -> self
|
|
1051
|
+
def deferred?: () -> bool
|
|
1052
|
+
def resolved?: () -> bool
|
|
1053
|
+
def pending?: () -> bool
|
|
1054
|
+
def result: () -> permission_result?
|
|
1055
|
+
def wait: (?timeout: Numeric?) -> permission_result
|
|
1056
|
+
def inspect: () -> String
|
|
1057
|
+
end
|
|
1058
|
+
|
|
1059
|
+
# Thread-safe queue of pending permission requests
|
|
1060
|
+
class PermissionQueue
|
|
1061
|
+
def initialize: () -> void
|
|
1062
|
+
def poll: () -> PermissionRequest?
|
|
1063
|
+
def pop: (?timeout: Numeric?) -> PermissionRequest?
|
|
1064
|
+
def empty?: () -> bool
|
|
1065
|
+
def size: () -> Integer
|
|
1066
|
+
def push: (PermissionRequest request) -> void
|
|
1067
|
+
def drain!: (?reason: String) -> Array[PermissionRequest]
|
|
1068
|
+
end
|
|
1069
|
+
|
|
1070
|
+
# Cumulative usage tracking across conversation turns
|
|
1071
|
+
class CumulativeUsage
|
|
1072
|
+
attr_reader input_tokens: Integer
|
|
1073
|
+
attr_reader output_tokens: Integer
|
|
1074
|
+
attr_reader cache_read_input_tokens: Integer
|
|
1075
|
+
attr_reader cache_creation_input_tokens: Integer
|
|
1076
|
+
attr_reader total_cost_usd: Float
|
|
1077
|
+
attr_reader num_turns: Integer
|
|
1078
|
+
attr_reader duration_ms: Integer
|
|
1079
|
+
attr_reader duration_api_ms: Integer
|
|
1080
|
+
|
|
1081
|
+
def initialize: () -> void
|
|
1082
|
+
def track: (untyped message) -> void
|
|
1083
|
+
def reset!: () -> void
|
|
1084
|
+
def to_h: () -> Hash[Symbol, Integer | Float]
|
|
1085
|
+
end
|
|
1086
|
+
|
|
1087
|
+
# Represents a complete agent turn
|
|
1088
|
+
class TurnResult
|
|
1089
|
+
attr_reader messages: Array[message]
|
|
1090
|
+
|
|
1091
|
+
def initialize: () -> void
|
|
1092
|
+
def <<: (message) -> self
|
|
1093
|
+
def result: () -> ResultMessage?
|
|
1094
|
+
def complete?: () -> bool
|
|
1095
|
+
|
|
1096
|
+
# Text & thinking
|
|
1097
|
+
def text: () -> String
|
|
1098
|
+
def thinking: () -> String
|
|
1099
|
+
|
|
1100
|
+
# Tool use
|
|
1101
|
+
def tool_uses: () -> Array[ToolUseBlock | ServerToolUseBlock]
|
|
1102
|
+
def tool_results: () -> Array[ToolResultBlock | ServerToolResultBlock]
|
|
1103
|
+
def tool_executions: () -> Array[Hash[Symbol, ToolUseBlock | ServerToolUseBlock | ToolResultBlock | ServerToolResultBlock | nil]]
|
|
1104
|
+
|
|
1105
|
+
# Result accessors
|
|
1106
|
+
def usage: () -> Hash[Symbol, Integer]?
|
|
1107
|
+
def cost: () -> Float?
|
|
1108
|
+
def duration_ms: () -> Integer?
|
|
1109
|
+
def duration_api_ms: () -> Integer?
|
|
1110
|
+
def session_id: () -> String?
|
|
1111
|
+
def num_turns: () -> Integer?
|
|
1112
|
+
def stop_reason: () -> String?
|
|
1113
|
+
def model: () -> String?
|
|
1114
|
+
def model_usage: () -> Hash[String, untyped]?
|
|
1115
|
+
def structured_output: () -> untyped
|
|
1116
|
+
def permission_denials: () -> Array[SDKPermissionDenial]
|
|
1117
|
+
def errors: () -> Array[String]
|
|
1118
|
+
|
|
1119
|
+
# Status
|
|
1120
|
+
def success?: () -> bool
|
|
1121
|
+
def error?: () -> bool
|
|
1122
|
+
def subtype: () -> String?
|
|
1123
|
+
|
|
1124
|
+
# Filtered message access
|
|
1125
|
+
def assistant_messages: () -> Array[AssistantMessage]
|
|
1126
|
+
def user_messages: () -> Array[UserMessage | UserMessageReplay]
|
|
1127
|
+
def stream_events: () -> Array[StreamEvent]
|
|
1128
|
+
def content_blocks: () -> Array[content_block]
|
|
1129
|
+
|
|
1130
|
+
def inspect: () -> String
|
|
1131
|
+
end
|
|
1132
|
+
|
|
1133
|
+
# Event handler for dispatching typed events from message streams
|
|
1134
|
+
class EventHandler
|
|
1135
|
+
def initialize: () -> void
|
|
1136
|
+
def on: (Symbol event) { (*untyped) -> void } -> self
|
|
1137
|
+
def on_message: () { (message) -> void } -> self
|
|
1138
|
+
def on_text: () { (String) -> void } -> self
|
|
1139
|
+
def on_thinking: () { (String) -> void } -> self
|
|
1140
|
+
def on_tool_use: () { (ToolUseBlock | ServerToolUseBlock) -> void } -> self
|
|
1141
|
+
def on_tool_result: () { (ToolResultBlock | ServerToolResultBlock, (ToolUseBlock | ServerToolUseBlock)?) -> void } -> self
|
|
1142
|
+
def on_result: () { (ResultMessage) -> void } -> self
|
|
1143
|
+
def handle: (message) -> void
|
|
1144
|
+
def reset!: () -> void
|
|
1145
|
+
def has_handlers?: () -> bool
|
|
1146
|
+
end
|
|
1147
|
+
|
|
1148
|
+
# A single tool execution in the conversation timeline
|
|
1149
|
+
class ToolActivity
|
|
1150
|
+
attr_reader tool_use: ToolUseBlock | ServerToolUseBlock
|
|
1151
|
+
attr_reader tool_result: ToolResultBlock | ServerToolResultBlock | nil
|
|
1152
|
+
attr_reader turn_index: Integer
|
|
1153
|
+
attr_reader started_at: Time?
|
|
1154
|
+
attr_reader completed_at: Time?
|
|
1155
|
+
|
|
1156
|
+
def initialize: (tool_use: ToolUseBlock | ServerToolUseBlock, ?tool_result: ToolResultBlock | ServerToolResultBlock | nil, turn_index: Integer, ?started_at: Time?, ?completed_at: Time?) -> void
|
|
1157
|
+
def name: () -> String
|
|
1158
|
+
def display_label: () -> String
|
|
1159
|
+
def summary: (?max: Integer) -> String
|
|
1160
|
+
def file_path: () -> String?
|
|
1161
|
+
def id: () -> String
|
|
1162
|
+
def error?: () -> bool
|
|
1163
|
+
def complete?: () -> bool
|
|
1164
|
+
def duration: () -> Float?
|
|
1165
|
+
end
|
|
1166
|
+
|
|
1167
|
+
# High-level conversation interface managing the full lifecycle
|
|
1168
|
+
class Conversation
|
|
1169
|
+
CONVERSATION_KEYS: Array[Symbol]
|
|
1170
|
+
|
|
1171
|
+
attr_reader turns: Array[TurnResult]
|
|
1172
|
+
attr_reader messages: Array[message]
|
|
1173
|
+
attr_reader tool_activity: Array[ToolActivity]
|
|
1174
|
+
attr_reader client: Client
|
|
1175
|
+
|
|
1176
|
+
def self.open: (**untyped) { (Conversation) -> void } -> void
|
|
1177
|
+
def self.resume: (String session_id, **untyped) -> Conversation
|
|
1178
|
+
|
|
1179
|
+
def initialize: (**untyped) -> void
|
|
1180
|
+
def say: (String | Array[content_block] prompt) -> TurnResult
|
|
1181
|
+
| (String | Array[content_block] prompt) { (message) -> void } -> TurnResult
|
|
1182
|
+
def total_cost: () -> Float
|
|
1183
|
+
def session_id: () -> String?
|
|
1184
|
+
def usage: () -> CumulativeUsage
|
|
1185
|
+
def pending_permission: () -> PermissionRequest?
|
|
1186
|
+
def pending_permissions?: () -> bool
|
|
1187
|
+
def close: () -> void
|
|
1188
|
+
def open?: () -> bool
|
|
1189
|
+
def closed?: () -> bool
|
|
1190
|
+
def inspect: () -> String
|
|
1191
|
+
end
|
|
1192
|
+
|
|
1193
|
+
# Session discovery
|
|
1194
|
+
def self.list_sessions: (?dir: String?, ?limit: Integer?) -> Array[SessionInfo]
|
|
1195
|
+
def self.get_session_messages: (String session_id, ?dir: String?, ?limit: Integer?, ?offset: Integer?) -> Array[SessionMessage]
|
|
1196
|
+
|
|
1197
|
+
# Shared session path infrastructure
|
|
1198
|
+
module SessionPaths
|
|
1199
|
+
MAX_SLUG_LENGTH: Integer
|
|
1200
|
+
UUID_PATTERN: Regexp
|
|
1201
|
+
|
|
1202
|
+
def self.config_dir: () -> String
|
|
1203
|
+
def self.projects_dir: () -> String
|
|
1204
|
+
def self.project_dir_for: (String path) -> String
|
|
1205
|
+
def self.encode_project_dir: (String path) -> String
|
|
1206
|
+
def self.java_string_hash: (String str) -> String
|
|
1207
|
+
def self.find_project_dir: (String path) -> String?
|
|
1208
|
+
def self.realpath: (String path) -> String
|
|
1209
|
+
def self.git_worktrees: (String dir) -> Array[String]
|
|
1210
|
+
end
|
|
948
1211
|
|
|
949
|
-
|
|
1212
|
+
# ListSessions module
|
|
1213
|
+
module ListSessions
|
|
1214
|
+
BUFFER_SIZE: Integer
|
|
1215
|
+
|
|
1216
|
+
def self.call: (?dir: String?, ?limit: Integer?) -> Array[SessionInfo]
|
|
1217
|
+
end
|
|
1218
|
+
|
|
1219
|
+
# GetSessionMessages module (TypeScript SDK v0.2.59 parity)
|
|
1220
|
+
module GetSessionMessages
|
|
1221
|
+
PARSEABLE_TYPES: Array[String]
|
|
1222
|
+
|
|
1223
|
+
def self.call: (String session_id, ?dir: String?, ?limit: Integer?, ?offset: Integer?) -> Array[SessionMessage]
|
|
950
1224
|
end
|
|
951
1225
|
|
|
1226
|
+
# Convenience methods
|
|
1227
|
+
def self.conversation: (**untyped) -> Conversation
|
|
1228
|
+
def self.resume_conversation: (String session_id, **untyped) -> Conversation
|
|
1229
|
+
|
|
952
1230
|
# Client
|
|
953
1231
|
class Client
|
|
954
1232
|
attr_reader options: Options
|
|
955
1233
|
attr_reader transport: Transport::Base
|
|
956
1234
|
attr_reader server_info: Hash[String, untyped]?
|
|
1235
|
+
attr_reader cumulative_usage: CumulativeUsage
|
|
1236
|
+
attr_reader event_handler: EventHandler
|
|
1237
|
+
attr_reader permission_queue: PermissionQueue
|
|
957
1238
|
|
|
958
1239
|
def self.open: (?options: Options?, ?transport: Transport::Base?, ?prompt: String?) { (Client) -> void } -> void
|
|
959
1240
|
|
|
@@ -963,10 +1244,21 @@ module ClaudeAgent
|
|
|
963
1244
|
def connected?: () -> bool
|
|
964
1245
|
def send_message: (String | Array[content_block] content, ?session_id: String, ?uuid: String?) -> void
|
|
965
1246
|
alias query send_message
|
|
1247
|
+
def on: (Symbol event) { (*untyped) -> void } -> self
|
|
1248
|
+
def on_message: () { (message) -> void } -> self
|
|
1249
|
+
def on_text: () { (String) -> void } -> self
|
|
1250
|
+
def on_thinking: () { (String) -> void } -> self
|
|
1251
|
+
def on_tool_use: () { (ToolUseBlock | ServerToolUseBlock) -> void } -> self
|
|
1252
|
+
def on_tool_result: () { (ToolResultBlock | ServerToolResultBlock, (ToolUseBlock | ServerToolUseBlock)?) -> void } -> self
|
|
1253
|
+
def on_result: () { (ResultMessage) -> void } -> self
|
|
966
1254
|
def receive_messages: () { (message) -> void } -> void
|
|
967
1255
|
| () -> Enumerator[message, void]
|
|
968
1256
|
def receive_response: () { (message) -> void } -> void
|
|
969
1257
|
| () -> Enumerator[message, void]
|
|
1258
|
+
def receive_turn: () -> TurnResult
|
|
1259
|
+
| () { (message) -> void } -> TurnResult
|
|
1260
|
+
def send_and_receive: (String | Array[content_block] content, ?session_id: String, ?uuid: String?) -> TurnResult
|
|
1261
|
+
| (String | Array[content_block] content, ?session_id: String, ?uuid: String?) { (message) -> void } -> TurnResult
|
|
970
1262
|
def stream_input: (Enumerable[String | Hash[String, untyped] | UserMessage] stream, ?session_id: String) -> void
|
|
971
1263
|
| (Enumerable[String | Hash[String, untyped] | UserMessage] stream, ?session_id: String) { (message) -> void } -> void
|
|
972
1264
|
def interrupt: () -> void
|
|
@@ -978,6 +1270,8 @@ module ClaudeAgent
|
|
|
978
1270
|
def set_mcp_servers: (Hash[String, untyped] servers) -> McpSetServersResult
|
|
979
1271
|
def mcp_reconnect: (String server_name) -> Hash[String, untyped]
|
|
980
1272
|
def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
|
|
1273
|
+
def mcp_authenticate: (String server_name) -> Hash[String, untyped]
|
|
1274
|
+
def mcp_clear_auth: (String server_name) -> Hash[String, untyped]
|
|
981
1275
|
def stop_task: (String task_id) -> Hash[String, untyped]
|
|
982
1276
|
def apply_flag_settings: (Hash[String, untyped] settings) -> Hash[String, untyped]
|
|
983
1277
|
def supported_commands: () -> Array[SlashCommand]
|
|
@@ -985,6 +1279,8 @@ module ClaudeAgent
|
|
|
985
1279
|
def mcp_server_status: () -> Array[McpServerStatus]
|
|
986
1280
|
def account_info: () -> AccountInfo
|
|
987
1281
|
def initialization_result: () -> InitializationResult
|
|
1282
|
+
def pending_permission: () -> PermissionRequest?
|
|
1283
|
+
def pending_permissions?: () -> bool
|
|
988
1284
|
end
|
|
989
1285
|
|
|
990
1286
|
# Control protocol
|
|
@@ -996,6 +1292,7 @@ module ClaudeAgent
|
|
|
996
1292
|
attr_reader transport: Transport::Base
|
|
997
1293
|
attr_reader options: Options
|
|
998
1294
|
attr_reader server_info: Hash[String, untyped]?
|
|
1295
|
+
attr_accessor permission_queue: PermissionQueue?
|
|
999
1296
|
|
|
1000
1297
|
def initialize: (transport: Transport::Base, ?options: Options?) -> void
|
|
1001
1298
|
def start: (?streaming: bool, ?prompt: String?) -> Hash[String, untyped]?
|
|
@@ -1016,6 +1313,8 @@ module ClaudeAgent
|
|
|
1016
1313
|
def set_mcp_servers: (Hash[String, untyped] servers) -> McpSetServersResult
|
|
1017
1314
|
def mcp_reconnect: (String server_name) -> Hash[String, untyped]
|
|
1018
1315
|
def mcp_toggle: (String server_name, enabled: bool) -> Hash[String, untyped]
|
|
1316
|
+
def mcp_authenticate: (String server_name) -> Hash[String, untyped]
|
|
1317
|
+
def mcp_clear_auth: (String server_name) -> Hash[String, untyped]
|
|
1019
1318
|
def stop_task: (String task_id) -> Hash[String, untyped]
|
|
1020
1319
|
def apply_flag_settings: (Hash[String, untyped] settings) -> Hash[String, untyped]
|
|
1021
1320
|
def supported_commands: () -> Array[SlashCommand]
|
|
@@ -1156,7 +1455,7 @@ module ClaudeAgent
|
|
|
1156
1455
|
end
|
|
1157
1456
|
|
|
1158
1457
|
# V2 Session interface for multi-turn conversations
|
|
1159
|
-
class
|
|
1458
|
+
class V2Session
|
|
1160
1459
|
attr_reader session_id: String?
|
|
1161
1460
|
attr_reader options: SessionOptions
|
|
1162
1461
|
|
|
@@ -1169,7 +1468,37 @@ module ClaudeAgent
|
|
|
1169
1468
|
end
|
|
1170
1469
|
|
|
1171
1470
|
# V2 API module-level methods
|
|
1172
|
-
def self.unstable_v2_create_session: (Hash[Symbol, untyped] | SessionOptions options) ->
|
|
1173
|
-
def self.unstable_v2_resume_session: (String session_id, Hash[Symbol, untyped] | SessionOptions options) ->
|
|
1471
|
+
def self.unstable_v2_create_session: (Hash[Symbol, untyped] | SessionOptions options) -> V2Session
|
|
1472
|
+
def self.unstable_v2_resume_session: (String session_id, Hash[Symbol, untyped] | SessionOptions options) -> V2Session
|
|
1174
1473
|
def self.unstable_v2_prompt: (String message, Hash[Symbol, untyped] | SessionOptions options) -> ResultMessage
|
|
1474
|
+
|
|
1475
|
+
# Chainable, lazy query object for session transcript messages
|
|
1476
|
+
class SessionMessageRelation
|
|
1477
|
+
include Enumerable[SessionMessage]
|
|
1478
|
+
|
|
1479
|
+
def initialize: (String session_id, ?dir: String?, ?limit: Integer?, ?offset: Integer?) -> void
|
|
1480
|
+
def where: (?limit: Integer?, ?offset: Integer?) -> SessionMessageRelation
|
|
1481
|
+
def each: () { (SessionMessage) -> void } -> void
|
|
1482
|
+
| () -> Enumerator[SessionMessage, void]
|
|
1483
|
+
def to_a: () -> Array[SessionMessage]
|
|
1484
|
+
end
|
|
1485
|
+
|
|
1486
|
+
# Historical session finder with Rails-like API
|
|
1487
|
+
class Session
|
|
1488
|
+
attr_reader session_id: String
|
|
1489
|
+
attr_reader summary: String
|
|
1490
|
+
attr_reader last_modified: Integer
|
|
1491
|
+
attr_reader file_size: Integer
|
|
1492
|
+
attr_reader custom_title: String?
|
|
1493
|
+
attr_reader first_prompt: String?
|
|
1494
|
+
attr_reader git_branch: String?
|
|
1495
|
+
attr_reader cwd: String?
|
|
1496
|
+
|
|
1497
|
+
def initialize: (SessionInfo session_info) -> void
|
|
1498
|
+
def messages: () -> SessionMessageRelation
|
|
1499
|
+
|
|
1500
|
+
def self.find: (String session_id, ?dir: String?) -> Session?
|
|
1501
|
+
def self.all: () -> Array[Session]
|
|
1502
|
+
def self.where: (?dir: String?, ?limit: Integer?) -> Array[Session]
|
|
1503
|
+
end
|
|
1175
1504
|
end
|
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.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Carr
|
|
@@ -55,21 +55,32 @@ 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
|
|
62
|
+
- lib/claude_agent/get_session_messages.rb
|
|
59
63
|
- lib/claude_agent/hooks.rb
|
|
64
|
+
- lib/claude_agent/list_sessions.rb
|
|
60
65
|
- lib/claude_agent/logging.rb
|
|
61
66
|
- lib/claude_agent/mcp/server.rb
|
|
62
67
|
- lib/claude_agent/mcp/tool.rb
|
|
63
68
|
- lib/claude_agent/message_parser.rb
|
|
64
69
|
- lib/claude_agent/messages.rb
|
|
65
70
|
- lib/claude_agent/options.rb
|
|
71
|
+
- lib/claude_agent/permission_queue.rb
|
|
72
|
+
- lib/claude_agent/permission_request.rb
|
|
66
73
|
- lib/claude_agent/permissions.rb
|
|
67
74
|
- lib/claude_agent/query.rb
|
|
68
75
|
- lib/claude_agent/sandbox_settings.rb
|
|
69
76
|
- lib/claude_agent/session.rb
|
|
77
|
+
- lib/claude_agent/session_message_relation.rb
|
|
78
|
+
- lib/claude_agent/session_paths.rb
|
|
70
79
|
- lib/claude_agent/spawn.rb
|
|
80
|
+
- lib/claude_agent/tool_activity.rb
|
|
71
81
|
- lib/claude_agent/transport/base.rb
|
|
72
82
|
- lib/claude_agent/transport/subprocess.rb
|
|
83
|
+
- lib/claude_agent/turn_result.rb
|
|
73
84
|
- lib/claude_agent/types.rb
|
|
74
85
|
- lib/claude_agent/version.rb
|
|
75
86
|
- sig/claude_agent.rbs
|