acp_ruby 0.1.0
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 +7 -0
- data/CHANGELOG.md +19 -0
- data/LICENSE.txt +21 -0
- data/README.md +125 -0
- data/lib/acp_ruby.rb +3 -0
- data/lib/agent_client_protocol/agent/connection.rb +125 -0
- data/lib/agent_client_protocol/agent/router.rb +62 -0
- data/lib/agent_client_protocol/agent.rb +49 -0
- data/lib/agent_client_protocol/client/connection.rb +112 -0
- data/lib/agent_client_protocol/client/router.rb +85 -0
- data/lib/agent_client_protocol/client.rb +53 -0
- data/lib/agent_client_protocol/connection.rb +144 -0
- data/lib/agent_client_protocol/contrib/permission_broker.rb +57 -0
- data/lib/agent_client_protocol/contrib/session_accumulator.rb +160 -0
- data/lib/agent_client_protocol/contrib/tool_call_tracker.rb +115 -0
- data/lib/agent_client_protocol/error.rb +41 -0
- data/lib/agent_client_protocol/helpers.rb +176 -0
- data/lib/agent_client_protocol/meta.rb +30 -0
- data/lib/agent_client_protocol/router.rb +108 -0
- data/lib/agent_client_protocol/schema/base_model.rb +158 -0
- data/lib/agent_client_protocol/schema/generated.rb +508 -0
- data/lib/agent_client_protocol/schema/types.rb +200 -0
- data/lib/agent_client_protocol/stdio.rb +129 -0
- data/lib/agent_client_protocol/transport.rb +70 -0
- data/lib/agent_client_protocol/version.rb +5 -0
- data/lib/agent_client_protocol.rb +54 -0
- data/schema/VERSION +1 -0
- data/schema/meta.json +24 -0
- data/schema/schema.json +3430 -0
- metadata +103 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# AUTO-GENERATED from schema.json — DO NOT EDIT
|
|
4
|
+
|
|
5
|
+
require_relative "base_model"
|
|
6
|
+
require_relative "types"
|
|
7
|
+
|
|
8
|
+
module AgentClientProtocol
|
|
9
|
+
module Schema
|
|
10
|
+
|
|
11
|
+
class McpCapabilities < BaseModel
|
|
12
|
+
property :_meta, type: :hash, default: nil
|
|
13
|
+
property :http, default: false
|
|
14
|
+
property :sse, default: false
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class PromptCapabilities < BaseModel
|
|
18
|
+
property :_meta, type: :hash, default: nil
|
|
19
|
+
property :audio, default: false
|
|
20
|
+
property :embedded_context, default: false
|
|
21
|
+
property :image, default: false
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class SessionCapabilities < BaseModel
|
|
25
|
+
property :_meta, type: :hash, default: nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class AgentCapabilities < BaseModel
|
|
29
|
+
property :_meta, type: :hash, default: nil
|
|
30
|
+
property :load_session, default: false
|
|
31
|
+
property :mcp_capabilities, type: McpCapabilities, default: {"http" => false, "sse" => false}
|
|
32
|
+
property :prompt_capabilities, type: PromptCapabilities, default: {"audio" => false, "embeddedContext" => false, "image" => false}
|
|
33
|
+
property :session_capabilities, type: SessionCapabilities, default: {}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Annotations < BaseModel
|
|
37
|
+
property :_meta, type: :hash, default: nil
|
|
38
|
+
property :audience
|
|
39
|
+
property :last_modified
|
|
40
|
+
property :priority
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class AudioContent < BaseModel
|
|
44
|
+
discriminator "type", "audio"
|
|
45
|
+
property :_meta, type: :hash, default: nil
|
|
46
|
+
property :annotations, type: Annotations, default: nil
|
|
47
|
+
property :data, required: true
|
|
48
|
+
property :mime_type, required: true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class AuthMethod < BaseModel
|
|
52
|
+
property :_meta, type: :hash, default: nil
|
|
53
|
+
property :description
|
|
54
|
+
property :id, required: true
|
|
55
|
+
property :name, required: true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class AuthenticateRequest < BaseModel
|
|
59
|
+
property :_meta, type: :hash, default: nil
|
|
60
|
+
property :method_id, required: true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class AuthenticateResponse < BaseModel
|
|
64
|
+
property :_meta, type: :hash, default: nil
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class AvailableCommand < BaseModel
|
|
68
|
+
property :_meta, type: :hash, default: nil
|
|
69
|
+
property :description, required: true
|
|
70
|
+
property :input, default: nil
|
|
71
|
+
property :name, required: true
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class AvailableCommandsUpdate < BaseModel
|
|
75
|
+
discriminator "sessionUpdate", "available_commands_update"
|
|
76
|
+
property :_meta, type: :hash, default: nil
|
|
77
|
+
property :available_commands, type: [:array, AvailableCommand], required: true
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class BlobResourceContents < BaseModel
|
|
81
|
+
property :_meta, type: :hash, default: nil
|
|
82
|
+
property :blob, required: true
|
|
83
|
+
property :mime_type
|
|
84
|
+
property :uri, required: true
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
class CancelNotification < BaseModel
|
|
88
|
+
property :_meta, type: :hash, default: nil
|
|
89
|
+
property :session_id, required: true
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
class FileSystemCapability < BaseModel
|
|
93
|
+
property :_meta, type: :hash, default: nil
|
|
94
|
+
property :read_text_file, default: false
|
|
95
|
+
property :write_text_file, default: false
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class ClientCapabilities < BaseModel
|
|
99
|
+
property :_meta, type: :hash, default: nil
|
|
100
|
+
property :fs, type: FileSystemCapability, default: {"readTextFile" => false, "writeTextFile" => false}
|
|
101
|
+
property :terminal, default: false
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
class ConfigOptionUpdate < BaseModel
|
|
105
|
+
discriminator "sessionUpdate", "config_option_update"
|
|
106
|
+
property :_meta, type: :hash, default: nil
|
|
107
|
+
property :config_options, type: [:array, SessionConfigOption], required: true
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
class Content < BaseModel
|
|
111
|
+
discriminator "type", "content"
|
|
112
|
+
property :_meta, type: :hash, default: nil
|
|
113
|
+
property :content, type: :content_block, required: true
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
class ContentChunk < BaseModel
|
|
117
|
+
property :_meta, type: :hash, default: nil
|
|
118
|
+
property :content, type: :content_block, required: true
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
class EnvVariable < BaseModel
|
|
122
|
+
property :_meta, type: :hash, default: nil
|
|
123
|
+
property :name, required: true
|
|
124
|
+
property :value, required: true
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
class CreateTerminalRequest < BaseModel
|
|
128
|
+
property :_meta, type: :hash, default: nil
|
|
129
|
+
property :args
|
|
130
|
+
property :command, required: true
|
|
131
|
+
property :cwd
|
|
132
|
+
property :env, type: [:array, EnvVariable]
|
|
133
|
+
property :output_byte_limit
|
|
134
|
+
property :session_id, required: true
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
class CreateTerminalResponse < BaseModel
|
|
138
|
+
property :_meta, type: :hash, default: nil
|
|
139
|
+
property :terminal_id, required: true
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
class CurrentModeUpdate < BaseModel
|
|
143
|
+
discriminator "sessionUpdate", "current_mode_update"
|
|
144
|
+
property :_meta, type: :hash, default: nil
|
|
145
|
+
property :current_mode_id, required: true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
class Diff < BaseModel
|
|
149
|
+
discriminator "type", "diff"
|
|
150
|
+
property :_meta, type: :hash, default: nil
|
|
151
|
+
property :new_text, required: true
|
|
152
|
+
property :old_text
|
|
153
|
+
property :path, required: true
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
class EmbeddedResource < BaseModel
|
|
157
|
+
discriminator "type", "resource"
|
|
158
|
+
property :_meta, type: :hash, default: nil
|
|
159
|
+
property :annotations, type: Annotations, default: nil
|
|
160
|
+
property :resource, required: true
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
class Error < BaseModel
|
|
164
|
+
property :code, required: true
|
|
165
|
+
property :data
|
|
166
|
+
property :message, required: true
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
class HttpHeader < BaseModel
|
|
170
|
+
property :_meta, type: :hash, default: nil
|
|
171
|
+
property :name, required: true
|
|
172
|
+
property :value, required: true
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
class ImageContent < BaseModel
|
|
176
|
+
discriminator "type", "image"
|
|
177
|
+
property :_meta, type: :hash, default: nil
|
|
178
|
+
property :annotations, type: Annotations, default: nil
|
|
179
|
+
property :data, required: true
|
|
180
|
+
property :mime_type, required: true
|
|
181
|
+
property :uri
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
class Implementation < BaseModel
|
|
185
|
+
property :_meta, type: :hash, default: nil
|
|
186
|
+
property :name, required: true
|
|
187
|
+
property :title
|
|
188
|
+
property :version, required: true
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
class InitializeRequest < BaseModel
|
|
192
|
+
property :_meta, type: :hash, default: nil
|
|
193
|
+
property :client_capabilities, type: ClientCapabilities, default: {"fs" => {"readTextFile" => false, "writeTextFile" => false}, "terminal" => false}
|
|
194
|
+
property :client_info, type: Implementation, default: nil
|
|
195
|
+
property :protocol_version, required: true
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
class InitializeResponse < BaseModel
|
|
199
|
+
property :_meta, type: :hash, default: nil
|
|
200
|
+
property :agent_capabilities, type: AgentCapabilities, default: {"loadSession" => false, "mcpCapabilities" => {"http" => false, "sse" => false}, "promptCapabilities" => {"audio" => false, "embeddedContext" => false, "image" => false}, "sessionCapabilities" => {}}
|
|
201
|
+
property :agent_info, type: Implementation, default: nil
|
|
202
|
+
property :auth_methods, type: [:array, AuthMethod], default: []
|
|
203
|
+
property :protocol_version, required: true
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
class KillTerminalCommandRequest < BaseModel
|
|
207
|
+
property :_meta, type: :hash, default: nil
|
|
208
|
+
property :session_id, required: true
|
|
209
|
+
property :terminal_id, required: true
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
class KillTerminalCommandResponse < BaseModel
|
|
213
|
+
property :_meta, type: :hash, default: nil
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
class LoadSessionRequest < BaseModel
|
|
217
|
+
property :_meta, type: :hash, default: nil
|
|
218
|
+
property :cwd, required: true
|
|
219
|
+
property :mcp_servers, required: true
|
|
220
|
+
property :session_id, required: true
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
class SessionMode < BaseModel
|
|
224
|
+
property :_meta, type: :hash, default: nil
|
|
225
|
+
property :description
|
|
226
|
+
property :id, required: true
|
|
227
|
+
property :name, required: true
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
class SessionModeState < BaseModel
|
|
231
|
+
property :_meta, type: :hash, default: nil
|
|
232
|
+
property :available_modes, type: [:array, SessionMode], required: true
|
|
233
|
+
property :current_mode_id, required: true
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
class LoadSessionResponse < BaseModel
|
|
237
|
+
property :_meta, type: :hash, default: nil
|
|
238
|
+
property :config_options, type: [:array, SessionConfigOption]
|
|
239
|
+
property :modes, type: SessionModeState, default: nil
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
class McpServerHttp < BaseModel
|
|
243
|
+
property :_meta, type: :hash, default: nil
|
|
244
|
+
property :headers, type: [:array, HttpHeader], required: true
|
|
245
|
+
property :name, required: true
|
|
246
|
+
property :url, required: true
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
class McpServerSse < BaseModel
|
|
250
|
+
property :_meta, type: :hash, default: nil
|
|
251
|
+
property :headers, type: [:array, HttpHeader], required: true
|
|
252
|
+
property :name, required: true
|
|
253
|
+
property :url, required: true
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
class McpServerStdio < BaseModel
|
|
257
|
+
property :_meta, type: :hash, default: nil
|
|
258
|
+
property :args, required: true
|
|
259
|
+
property :command, required: true
|
|
260
|
+
property :env, type: [:array, EnvVariable], required: true
|
|
261
|
+
property :name, required: true
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
class NewSessionRequest < BaseModel
|
|
265
|
+
property :_meta, type: :hash, default: nil
|
|
266
|
+
property :cwd, required: true
|
|
267
|
+
property :mcp_servers, required: true
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
class NewSessionResponse < BaseModel
|
|
271
|
+
property :_meta, type: :hash, default: nil
|
|
272
|
+
property :config_options, type: [:array, SessionConfigOption]
|
|
273
|
+
property :modes, type: SessionModeState, default: nil
|
|
274
|
+
property :session_id, required: true
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
class PermissionOption < BaseModel
|
|
278
|
+
property :_meta, type: :hash, default: nil
|
|
279
|
+
property :kind, required: true
|
|
280
|
+
property :name, required: true
|
|
281
|
+
property :option_id, required: true
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
class PlanEntry < BaseModel
|
|
285
|
+
property :_meta, type: :hash, default: nil
|
|
286
|
+
property :content, required: true
|
|
287
|
+
property :priority, required: true
|
|
288
|
+
property :status, required: true
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
class Plan < BaseModel
|
|
292
|
+
discriminator "sessionUpdate", "plan"
|
|
293
|
+
property :_meta, type: :hash, default: nil
|
|
294
|
+
property :entries, type: [:array, PlanEntry], required: true
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
class PromptRequest < BaseModel
|
|
298
|
+
property :_meta, type: :hash, default: nil
|
|
299
|
+
property :prompt, type: [:array, :content_block], required: true
|
|
300
|
+
property :session_id, required: true
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
class PromptResponse < BaseModel
|
|
304
|
+
property :_meta, type: :hash, default: nil
|
|
305
|
+
property :stop_reason, required: true
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
class ReadTextFileRequest < BaseModel
|
|
309
|
+
property :_meta, type: :hash, default: nil
|
|
310
|
+
property :limit
|
|
311
|
+
property :line
|
|
312
|
+
property :path, required: true
|
|
313
|
+
property :session_id, required: true
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
class ReadTextFileResponse < BaseModel
|
|
317
|
+
property :_meta, type: :hash, default: nil
|
|
318
|
+
property :content, required: true
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
class ReleaseTerminalRequest < BaseModel
|
|
322
|
+
property :_meta, type: :hash, default: nil
|
|
323
|
+
property :session_id, required: true
|
|
324
|
+
property :terminal_id, required: true
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
class ReleaseTerminalResponse < BaseModel
|
|
328
|
+
property :_meta, type: :hash, default: nil
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
class ToolCallLocation < BaseModel
|
|
332
|
+
property :_meta, type: :hash, default: nil
|
|
333
|
+
property :line
|
|
334
|
+
property :path, required: true
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
class ToolCallUpdate < BaseModel
|
|
338
|
+
discriminator "sessionUpdate", "tool_call_update"
|
|
339
|
+
property :_meta, type: :hash, default: nil
|
|
340
|
+
property :content, type: [:array, :tool_call_content]
|
|
341
|
+
property :kind, default: nil
|
|
342
|
+
property :locations, type: [:array, ToolCallLocation]
|
|
343
|
+
property :raw_input
|
|
344
|
+
property :raw_output
|
|
345
|
+
property :status, default: nil
|
|
346
|
+
property :title
|
|
347
|
+
property :tool_call_id, required: true
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
class RequestPermissionRequest < BaseModel
|
|
351
|
+
property :_meta, type: :hash, default: nil
|
|
352
|
+
property :options, type: [:array, PermissionOption], required: true
|
|
353
|
+
property :session_id, required: true
|
|
354
|
+
property :tool_call, type: ToolCallUpdate, required: true
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
class RequestPermissionResponse < BaseModel
|
|
358
|
+
property :_meta, type: :hash, default: nil
|
|
359
|
+
property :outcome, type: :permission_outcome, required: true
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
class ResourceLink < BaseModel
|
|
363
|
+
discriminator "type", "resource_link"
|
|
364
|
+
property :_meta, type: :hash, default: nil
|
|
365
|
+
property :annotations, type: Annotations, default: nil
|
|
366
|
+
property :description
|
|
367
|
+
property :mime_type
|
|
368
|
+
property :name, required: true
|
|
369
|
+
property :size
|
|
370
|
+
property :title
|
|
371
|
+
property :uri, required: true
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
class SelectedPermissionOutcome < BaseModel
|
|
375
|
+
discriminator "outcome", "selected"
|
|
376
|
+
property :_meta, type: :hash, default: nil
|
|
377
|
+
property :option_id, required: true
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
class SessionConfigSelect < BaseModel
|
|
381
|
+
discriminator "type", "select"
|
|
382
|
+
property :current_value, required: true
|
|
383
|
+
property :options, required: true
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
class SessionConfigSelectOption < BaseModel
|
|
387
|
+
property :_meta, type: :hash, default: nil
|
|
388
|
+
property :description
|
|
389
|
+
property :name, required: true
|
|
390
|
+
property :value, required: true
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
class SessionConfigSelectGroup < BaseModel
|
|
394
|
+
property :_meta, type: :hash, default: nil
|
|
395
|
+
property :group, required: true
|
|
396
|
+
property :name, required: true
|
|
397
|
+
property :options, type: [:array, SessionConfigSelectOption], required: true
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
class SessionNotification < BaseModel
|
|
401
|
+
property :_meta, type: :hash, default: nil
|
|
402
|
+
property :session_id, required: true
|
|
403
|
+
property :update, type: :session_update, required: true
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
class SetSessionConfigOptionRequest < BaseModel
|
|
407
|
+
property :_meta, type: :hash, default: nil
|
|
408
|
+
property :config_id, required: true
|
|
409
|
+
property :session_id, required: true
|
|
410
|
+
property :value, required: true
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
class SetSessionConfigOptionResponse < BaseModel
|
|
414
|
+
property :_meta, type: :hash, default: nil
|
|
415
|
+
property :config_options, type: [:array, SessionConfigOption], required: true
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
class SetSessionModeRequest < BaseModel
|
|
419
|
+
property :_meta, type: :hash, default: nil
|
|
420
|
+
property :mode_id, required: true
|
|
421
|
+
property :session_id, required: true
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
class SetSessionModeResponse < BaseModel
|
|
425
|
+
property :_meta, type: :hash, default: nil
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
class Terminal < BaseModel
|
|
429
|
+
discriminator "type", "terminal"
|
|
430
|
+
property :_meta, type: :hash, default: nil
|
|
431
|
+
property :terminal_id, required: true
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
class TerminalExitStatus < BaseModel
|
|
435
|
+
property :_meta, type: :hash, default: nil
|
|
436
|
+
property :exit_code
|
|
437
|
+
property :signal
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
class TerminalOutputRequest < BaseModel
|
|
441
|
+
property :_meta, type: :hash, default: nil
|
|
442
|
+
property :session_id, required: true
|
|
443
|
+
property :terminal_id, required: true
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
class TerminalOutputResponse < BaseModel
|
|
447
|
+
property :_meta, type: :hash, default: nil
|
|
448
|
+
property :exit_status, type: TerminalExitStatus, default: nil
|
|
449
|
+
property :output, required: true
|
|
450
|
+
property :truncated, required: true
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
class TextContent < BaseModel
|
|
454
|
+
discriminator "type", "text"
|
|
455
|
+
property :_meta, type: :hash, default: nil
|
|
456
|
+
property :annotations, type: Annotations, default: nil
|
|
457
|
+
property :text, required: true
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
class TextResourceContents < BaseModel
|
|
461
|
+
property :_meta, type: :hash, default: nil
|
|
462
|
+
property :mime_type
|
|
463
|
+
property :text, required: true
|
|
464
|
+
property :uri, required: true
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
class ToolCall < BaseModel
|
|
468
|
+
discriminator "sessionUpdate", "tool_call"
|
|
469
|
+
property :_meta, type: :hash, default: nil
|
|
470
|
+
property :content, type: [:array, :tool_call_content]
|
|
471
|
+
property :kind
|
|
472
|
+
property :locations, type: [:array, ToolCallLocation]
|
|
473
|
+
property :raw_input
|
|
474
|
+
property :raw_output
|
|
475
|
+
property :status
|
|
476
|
+
property :title, required: true
|
|
477
|
+
property :tool_call_id, required: true
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
class UnstructuredCommandInput < BaseModel
|
|
481
|
+
property :_meta, type: :hash, default: nil
|
|
482
|
+
property :hint, required: true
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
class WaitForTerminalExitRequest < BaseModel
|
|
486
|
+
property :_meta, type: :hash, default: nil
|
|
487
|
+
property :session_id, required: true
|
|
488
|
+
property :terminal_id, required: true
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
class WaitForTerminalExitResponse < BaseModel
|
|
492
|
+
property :_meta, type: :hash, default: nil
|
|
493
|
+
property :exit_code
|
|
494
|
+
property :signal
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
class WriteTextFileRequest < BaseModel
|
|
498
|
+
property :_meta, type: :hash, default: nil
|
|
499
|
+
property :content, required: true
|
|
500
|
+
property :path, required: true
|
|
501
|
+
property :session_id, required: true
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
class WriteTextFileResponse < BaseModel
|
|
505
|
+
property :_meta, type: :hash, default: nil
|
|
506
|
+
end
|
|
507
|
+
end
|
|
508
|
+
end
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# AUTO-GENERATED from schema.json — DO NOT EDIT
|
|
4
|
+
|
|
5
|
+
module AgentClientProtocol
|
|
6
|
+
module Schema
|
|
7
|
+
|
|
8
|
+
module PermissionOptionKind
|
|
9
|
+
ALLOW_ONCE = "allow_once".freeze
|
|
10
|
+
ALLOW_ALWAYS = "allow_always".freeze
|
|
11
|
+
REJECT_ONCE = "reject_once".freeze
|
|
12
|
+
REJECT_ALWAYS = "reject_always".freeze
|
|
13
|
+
ALL = [ALLOW_ONCE, ALLOW_ALWAYS, REJECT_ONCE, REJECT_ALWAYS].freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module PlanEntryPriority
|
|
17
|
+
HIGH = "high".freeze
|
|
18
|
+
MEDIUM = "medium".freeze
|
|
19
|
+
LOW = "low".freeze
|
|
20
|
+
ALL = [HIGH, MEDIUM, LOW].freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module PlanEntryStatus
|
|
24
|
+
PENDING = "pending".freeze
|
|
25
|
+
IN_PROGRESS = "in_progress".freeze
|
|
26
|
+
COMPLETED = "completed".freeze
|
|
27
|
+
ALL = [PENDING, IN_PROGRESS, COMPLETED].freeze
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
module StopReason
|
|
31
|
+
END_TURN = "end_turn".freeze
|
|
32
|
+
MAX_TOKENS = "max_tokens".freeze
|
|
33
|
+
MAX_TURN_REQUESTS = "max_turn_requests".freeze
|
|
34
|
+
REFUSAL = "refusal".freeze
|
|
35
|
+
CANCELLED = "cancelled".freeze
|
|
36
|
+
ALL = [END_TURN, MAX_TOKENS, MAX_TURN_REQUESTS, REFUSAL, CANCELLED].freeze
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
module ToolCallStatus
|
|
40
|
+
PENDING = "pending".freeze
|
|
41
|
+
IN_PROGRESS = "in_progress".freeze
|
|
42
|
+
COMPLETED = "completed".freeze
|
|
43
|
+
FAILED = "failed".freeze
|
|
44
|
+
ALL = [PENDING, IN_PROGRESS, COMPLETED, FAILED].freeze
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
module ToolKind
|
|
48
|
+
READ = "read".freeze
|
|
49
|
+
EDIT = "edit".freeze
|
|
50
|
+
DELETE = "delete".freeze
|
|
51
|
+
MOVE = "move".freeze
|
|
52
|
+
SEARCH = "search".freeze
|
|
53
|
+
EXECUTE = "execute".freeze
|
|
54
|
+
THINK = "think".freeze
|
|
55
|
+
FETCH = "fetch".freeze
|
|
56
|
+
SWITCH_MODE = "switch_mode".freeze
|
|
57
|
+
OTHER = "other".freeze
|
|
58
|
+
ALL = [READ, EDIT, DELETE, MOVE, SEARCH, EXECUTE, THINK, FETCH, SWITCH_MODE, OTHER].freeze
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
module ContentBlock
|
|
62
|
+
TEXT = "text".freeze
|
|
63
|
+
IMAGE = "image".freeze
|
|
64
|
+
AUDIO = "audio".freeze
|
|
65
|
+
RESOURCE_LINK = "resource_link".freeze
|
|
66
|
+
RESOURCE = "resource".freeze
|
|
67
|
+
|
|
68
|
+
def self.parse(hash)
|
|
69
|
+
return nil if hash.nil?
|
|
70
|
+
disc = hash["type"]
|
|
71
|
+
case disc
|
|
72
|
+
when "text"
|
|
73
|
+
obj = TextContent.from_hash(hash)
|
|
74
|
+
obj
|
|
75
|
+
when "image"
|
|
76
|
+
obj = ImageContent.from_hash(hash)
|
|
77
|
+
obj
|
|
78
|
+
when "audio"
|
|
79
|
+
obj = AudioContent.from_hash(hash)
|
|
80
|
+
obj
|
|
81
|
+
when "resource_link"
|
|
82
|
+
obj = ResourceLink.from_hash(hash)
|
|
83
|
+
obj
|
|
84
|
+
when "resource"
|
|
85
|
+
obj = EmbeddedResource.from_hash(hash)
|
|
86
|
+
obj
|
|
87
|
+
else
|
|
88
|
+
hash
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
module RequestPermissionOutcome
|
|
94
|
+
CANCELLED = "cancelled".freeze
|
|
95
|
+
SELECTED = "selected".freeze
|
|
96
|
+
|
|
97
|
+
def self.parse(hash)
|
|
98
|
+
return nil if hash.nil?
|
|
99
|
+
disc = hash["outcome"]
|
|
100
|
+
case disc
|
|
101
|
+
when "cancelled"
|
|
102
|
+
hash
|
|
103
|
+
when "selected"
|
|
104
|
+
obj = SelectedPermissionOutcome.from_hash(hash)
|
|
105
|
+
obj
|
|
106
|
+
else
|
|
107
|
+
hash
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
module SessionConfigOption
|
|
113
|
+
SELECT = "select".freeze
|
|
114
|
+
|
|
115
|
+
def self.parse(hash)
|
|
116
|
+
return nil if hash.nil?
|
|
117
|
+
disc = hash["type"]
|
|
118
|
+
case disc
|
|
119
|
+
when "select"
|
|
120
|
+
obj = SessionConfigSelect.from_hash(hash)
|
|
121
|
+
obj
|
|
122
|
+
else
|
|
123
|
+
hash
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
module SessionUpdate
|
|
129
|
+
USER_MESSAGE_CHUNK = "user_message_chunk".freeze
|
|
130
|
+
AGENT_MESSAGE_CHUNK = "agent_message_chunk".freeze
|
|
131
|
+
AGENT_THOUGHT_CHUNK = "agent_thought_chunk".freeze
|
|
132
|
+
TOOL_CALL = "tool_call".freeze
|
|
133
|
+
TOOL_CALL_UPDATE = "tool_call_update".freeze
|
|
134
|
+
PLAN = "plan".freeze
|
|
135
|
+
AVAILABLE_COMMANDS_UPDATE = "available_commands_update".freeze
|
|
136
|
+
CURRENT_MODE_UPDATE = "current_mode_update".freeze
|
|
137
|
+
CONFIG_OPTION_UPDATE = "config_option_update".freeze
|
|
138
|
+
|
|
139
|
+
def self.parse(hash)
|
|
140
|
+
return nil if hash.nil?
|
|
141
|
+
disc = hash["sessionUpdate"]
|
|
142
|
+
case disc
|
|
143
|
+
when "user_message_chunk"
|
|
144
|
+
obj = ContentChunk.from_hash(hash)
|
|
145
|
+
obj
|
|
146
|
+
when "agent_message_chunk"
|
|
147
|
+
obj = ContentChunk.from_hash(hash)
|
|
148
|
+
obj
|
|
149
|
+
when "agent_thought_chunk"
|
|
150
|
+
obj = ContentChunk.from_hash(hash)
|
|
151
|
+
obj
|
|
152
|
+
when "tool_call"
|
|
153
|
+
obj = ToolCall.from_hash(hash)
|
|
154
|
+
obj
|
|
155
|
+
when "tool_call_update"
|
|
156
|
+
obj = ToolCallUpdate.from_hash(hash)
|
|
157
|
+
obj
|
|
158
|
+
when "plan"
|
|
159
|
+
obj = Plan.from_hash(hash)
|
|
160
|
+
obj
|
|
161
|
+
when "available_commands_update"
|
|
162
|
+
obj = AvailableCommandsUpdate.from_hash(hash)
|
|
163
|
+
obj
|
|
164
|
+
when "current_mode_update"
|
|
165
|
+
obj = CurrentModeUpdate.from_hash(hash)
|
|
166
|
+
obj
|
|
167
|
+
when "config_option_update"
|
|
168
|
+
obj = ConfigOptionUpdate.from_hash(hash)
|
|
169
|
+
obj
|
|
170
|
+
else
|
|
171
|
+
hash
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
module ToolCallContent
|
|
177
|
+
CONTENT = "content".freeze
|
|
178
|
+
DIFF = "diff".freeze
|
|
179
|
+
TERMINAL = "terminal".freeze
|
|
180
|
+
|
|
181
|
+
def self.parse(hash)
|
|
182
|
+
return nil if hash.nil?
|
|
183
|
+
disc = hash["type"]
|
|
184
|
+
case disc
|
|
185
|
+
when "content"
|
|
186
|
+
obj = Content.from_hash(hash)
|
|
187
|
+
obj
|
|
188
|
+
when "diff"
|
|
189
|
+
obj = Diff.from_hash(hash)
|
|
190
|
+
obj
|
|
191
|
+
when "terminal"
|
|
192
|
+
obj = Terminal.from_hash(hash)
|
|
193
|
+
obj
|
|
194
|
+
else
|
|
195
|
+
hash
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|