-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathschema.py
More file actions
1567 lines (1381 loc) · 65.8 KB
/
schema.py
File metadata and controls
1567 lines (1381 loc) · 65.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Generated from schema/schema.json. Do not edit by hand.
# Schema ref: refs/tags/v0.6.3
from __future__ import annotations
from enum import Enum
from typing import Annotated, Any, List, Literal, Optional, Union
from pydantic import BaseModel as _BaseModel, Field, RootModel, ConfigDict
PermissionOptionKind = Literal["allow_once", "allow_always", "reject_once", "reject_always"]
PlanEntryPriority = Literal["high", "medium", "low"]
PlanEntryStatus = Literal["pending", "in_progress", "completed"]
StopReason = Literal["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled"]
ToolCallStatus = Literal["pending", "in_progress", "completed", "failed"]
ToolKind = Literal["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other"]
class BaseModel(_BaseModel):
model_config = ConfigDict(populate_by_name=True)
class Jsonrpc(Enum):
field_2_0 = "2.0"
class AuthenticateRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The ID of the authentication method to use.
# Must be one of the methods advertised in the initialize response.
methodId: Annotated[
str,
Field(
description="The ID of the authentication method to use.\nMust be one of the methods advertised in the initialize response."
),
]
class AuthenticateResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
class CommandInputHint(BaseModel):
# A hint to display when the input hasn't been provided yet
hint: Annotated[
str,
Field(description="A hint to display when the input hasn't been provided yet"),
]
class AvailableCommandInput(RootModel[CommandInputHint]):
# The input specification for a command.
root: Annotated[
CommandInputHint,
Field(description="The input specification for a command."),
]
class BlobResourceContents(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
blob: str
mimeType: Optional[str] = None
uri: str
class CreateTerminalResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The unique identifier for the created terminal.
terminalId: Annotated[str, Field(description="The unique identifier for the created terminal.")]
class EnvVariable(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The name of the environment variable.
name: Annotated[str, Field(description="The name of the environment variable.")]
# The value to set for the environment variable.
value: Annotated[str, Field(description="The value to set for the environment variable.")]
class Error(BaseModel):
# A number indicating the error type that occurred.
# This must be an integer as defined in the JSON-RPC specification.
code: Annotated[
int,
Field(
description="A number indicating the error type that occurred.\nThis must be an integer as defined in the JSON-RPC specification."
),
]
# Optional primitive or structured value that contains additional information about the error.
# This may include debugging information or context-specific details.
data: Annotated[
Optional[Any],
Field(
description="Optional primitive or structured value that contains additional information about the error.\nThis may include debugging information or context-specific details."
),
] = None
# A string providing a short description of the error.
# The message should be limited to a concise single sentence.
message: Annotated[
str,
Field(
description="A string providing a short description of the error.\nThe message should be limited to a concise single sentence."
),
]
class FileSystemCapability(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Whether the Client supports `fs/read_text_file` requests.
readTextFile: Annotated[
Optional[bool],
Field(description="Whether the Client supports `fs/read_text_file` requests."),
] = False
# Whether the Client supports `fs/write_text_file` requests.
writeTextFile: Annotated[
Optional[bool],
Field(description="Whether the Client supports `fs/write_text_file` requests."),
] = False
class HttpHeader(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The name of the HTTP header.
name: Annotated[str, Field(description="The name of the HTTP header.")]
# The value to set for the HTTP header.
value: Annotated[str, Field(description="The value to set for the HTTP header.")]
class Implementation(BaseModel):
# Intended for programmatic or logical use, but can be used as a display
# name fallback if title isn’t present.
name: Annotated[
str,
Field(
description="Intended for programmatic or logical use, but can be used as a display\nname fallback if title isn’t present."
),
]
# Intended for UI and end-user contexts — optimized to be human-readable
# and easily understood.
#
# If not provided, the name should be used for display.
title: Annotated[
Optional[str],
Field(
description="Intended for UI and end-user contexts — optimized to be human-readable\nand easily understood.\n\nIf not provided, the name should be used for display."
),
] = None
# Version of the implementation. Can be displayed to the user or used
# for debugging or metrics purposes.
version: Annotated[
str,
Field(
description="Version of the implementation. Can be displayed to the user or used\nfor debugging or metrics purposes."
),
]
class KillTerminalCommandResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
class McpCapabilities(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Agent supports [`McpServer::Http`].
http: Annotated[Optional[bool], Field(description="Agent supports [`McpServer::Http`].")] = False
# Agent supports [`McpServer::Sse`].
sse: Annotated[Optional[bool], Field(description="Agent supports [`McpServer::Sse`].")] = False
class HttpMcpServer(BaseModel):
# HTTP headers to set when making requests to the MCP server.
headers: Annotated[
List[HttpHeader],
Field(description="HTTP headers to set when making requests to the MCP server."),
]
# Human-readable name identifying this MCP server.
name: Annotated[str, Field(description="Human-readable name identifying this MCP server.")]
type: Literal["http"]
# URL to the MCP server.
url: Annotated[str, Field(description="URL to the MCP server.")]
class SseMcpServer(BaseModel):
# HTTP headers to set when making requests to the MCP server.
headers: Annotated[
List[HttpHeader],
Field(description="HTTP headers to set when making requests to the MCP server."),
]
# Human-readable name identifying this MCP server.
name: Annotated[str, Field(description="Human-readable name identifying this MCP server.")]
type: Literal["sse"]
# URL to the MCP server.
url: Annotated[str, Field(description="URL to the MCP server.")]
class StdioMcpServer(BaseModel):
# Command-line arguments to pass to the MCP server.
args: Annotated[
List[str],
Field(description="Command-line arguments to pass to the MCP server."),
]
# Path to the MCP server executable.
command: Annotated[str, Field(description="Path to the MCP server executable.")]
# Environment variables to set when launching the MCP server.
env: Annotated[
List[EnvVariable],
Field(description="Environment variables to set when launching the MCP server."),
]
# Human-readable name identifying this MCP server.
name: Annotated[str, Field(description="Human-readable name identifying this MCP server.")]
type: Literal["stdio"] = "stdio"
class ModelInfo(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Optional description of the model.
description: Annotated[Optional[str], Field(description="Optional description of the model.")] = None
# Unique identifier for the model.
modelId: Annotated[str, Field(description="Unique identifier for the model.")]
# Human-readable name of the model.
name: Annotated[str, Field(description="Human-readable name of the model.")]
class NewSessionRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The working directory for this session. Must be an absolute path.
cwd: Annotated[
str,
Field(description="The working directory for this session. Must be an absolute path."),
]
# List of MCP (Model Context Protocol) servers the agent should connect to.
mcpServers: Annotated[
List[Union[HttpMcpServer, SseMcpServer, StdioMcpServer]],
Field(description="List of MCP (Model Context Protocol) servers the agent should connect to."),
]
class PromptCapabilities(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Agent supports [`ContentBlock::Audio`].
audio: Annotated[Optional[bool], Field(description="Agent supports [`ContentBlock::Audio`].")] = False
# Agent supports embedded context in `session/prompt` requests.
#
# When enabled, the Client is allowed to include [`ContentBlock::Resource`]
# in prompt requests for pieces of context that are referenced in the message.
embeddedContext: Annotated[
Optional[bool],
Field(
description="Agent supports embedded context in `session/prompt` requests.\n\nWhen enabled, the Client is allowed to include [`ContentBlock::Resource`]\nin prompt requests for pieces of context that are referenced in the message."
),
] = False
# Agent supports [`ContentBlock::Image`].
image: Annotated[Optional[bool], Field(description="Agent supports [`ContentBlock::Image`].")] = False
class ReadTextFileResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
content: str
class ReleaseTerminalResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
class DeniedOutcome(BaseModel):
outcome: Literal["cancelled"]
class AllowedOutcome(BaseModel):
# The ID of the option the user selected.
optionId: Annotated[str, Field(description="The ID of the option the user selected.")]
outcome: Literal["selected"]
class RequestPermissionResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The user's decision on the permission request.
outcome: Annotated[
Union[DeniedOutcome, AllowedOutcome],
Field(
description="The user's decision on the permission request.",
discriminator="outcome",
),
]
class Role(Enum):
assistant = "assistant"
user = "user"
class SessionModelState(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The set of models that the Agent can use
availableModels: Annotated[List[ModelInfo], Field(description="The set of models that the Agent can use")]
# The current model the Agent is in.
currentModelId: Annotated[str, Field(description="The current model the Agent is in.")]
class CurrentModeUpdate(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The ID of the current mode
currentModeId: Annotated[str, Field(description="The ID of the current mode")]
sessionUpdate: Literal["current_mode_update"]
class SetSessionModeRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The ID of the mode to set.
modeId: Annotated[str, Field(description="The ID of the mode to set.")]
# The ID of the session to set the mode for.
sessionId: Annotated[str, Field(description="The ID of the session to set the mode for.")]
class SetSessionModeResponse(BaseModel):
field_meta: Annotated[Optional[Any], Field(alias="_meta")] = None
class SetSessionModelRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The ID of the model to set.
modelId: Annotated[str, Field(description="The ID of the model to set.")]
# The ID of the session to set the model for.
sessionId: Annotated[str, Field(description="The ID of the session to set the model for.")]
class SetSessionModelResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
class TerminalExitStatus(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The process exit code (may be null if terminated by signal).
exitCode: Annotated[
Optional[int],
Field(
description="The process exit code (may be null if terminated by signal).",
ge=0,
),
] = None
# The signal that terminated the process (may be null if exited normally).
signal: Annotated[
Optional[str],
Field(description="The signal that terminated the process (may be null if exited normally)."),
] = None
class TerminalOutputRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
# The ID of the terminal to get output from.
terminalId: Annotated[str, Field(description="The ID of the terminal to get output from.")]
class TerminalOutputResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Exit status if the command has completed.
exitStatus: Annotated[
Optional[TerminalExitStatus],
Field(description="Exit status if the command has completed."),
] = None
# The terminal output captured so far.
output: Annotated[str, Field(description="The terminal output captured so far.")]
# Whether the output was truncated due to byte limits.
truncated: Annotated[bool, Field(description="Whether the output was truncated due to byte limits.")]
class TextResourceContents(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
mimeType: Optional[str] = None
text: str
uri: str
class FileEditToolCallContent(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The new content after modification.
newText: Annotated[str, Field(description="The new content after modification.")]
# The original content (None for new files).
oldText: Annotated[Optional[str], Field(description="The original content (None for new files).")] = None
# The file path being modified.
path: Annotated[str, Field(description="The file path being modified.")]
type: Literal["diff"]
class TerminalToolCallContent(BaseModel):
terminalId: str
type: Literal["terminal"]
class ToolCallLocation(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Optional line number within the file.
line: Annotated[Optional[int], Field(description="Optional line number within the file.", ge=0)] = None
# The file path being accessed or modified.
path: Annotated[str, Field(description="The file path being accessed or modified.")]
class WaitForTerminalExitRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
# The ID of the terminal to wait for.
terminalId: Annotated[str, Field(description="The ID of the terminal to wait for.")]
class WaitForTerminalExitResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The process exit code (may be null if terminated by signal).
exitCode: Annotated[
Optional[int],
Field(
description="The process exit code (may be null if terminated by signal).",
ge=0,
),
] = None
# The signal that terminated the process (may be null if exited normally).
signal: Annotated[
Optional[str],
Field(description="The signal that terminated the process (may be null if exited normally)."),
] = None
class WriteTextFileRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The text content to write to the file.
content: Annotated[str, Field(description="The text content to write to the file.")]
# Absolute path to the file to write.
path: Annotated[str, Field(description="Absolute path to the file to write.")]
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
class WriteTextFileResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
class AgentCapabilities(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Whether the agent supports `session/load`.
loadSession: Annotated[Optional[bool], Field(description="Whether the agent supports `session/load`.")] = False
# MCP capabilities supported by the agent.
mcpCapabilities: Annotated[
Optional[McpCapabilities],
Field(description="MCP capabilities supported by the agent."),
] = McpCapabilities(http=False, sse=False)
# Prompt capabilities supported by the agent.
promptCapabilities: Annotated[
Optional[PromptCapabilities],
Field(description="Prompt capabilities supported by the agent."),
] = PromptCapabilities(audio=False, embeddedContext=False, image=False)
class AgentErrorMessage(BaseModel):
jsonrpc: Jsonrpc
# JSON RPC Request Id
#
# An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]
#
# The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
#
# [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.
#
# [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.
id: Annotated[
Optional[Union[int, str]],
Field(
description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions."
),
] = None
error: Error
class Annotations(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
audience: Optional[List[Role]] = None
lastModified: Optional[str] = None
priority: Optional[float] = None
class AuthMethod(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Optional description providing more details about this authentication method.
description: Annotated[
Optional[str],
Field(description="Optional description providing more details about this authentication method."),
] = None
# Unique identifier for this authentication method.
id: Annotated[str, Field(description="Unique identifier for this authentication method.")]
# Human-readable name of the authentication method.
name: Annotated[str, Field(description="Human-readable name of the authentication method.")]
class AvailableCommand(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Human-readable description of what the command does.
description: Annotated[str, Field(description="Human-readable description of what the command does.")]
# Input for the command if required
input: Annotated[
Optional[AvailableCommandInput],
Field(description="Input for the command if required"),
] = None
# Command name (e.g., `create_plan`, `research_codebase`).
name: Annotated[
str,
Field(description="Command name (e.g., `create_plan`, `research_codebase`)."),
]
class CancelNotification(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The ID of the session to cancel operations for.
sessionId: Annotated[str, Field(description="The ID of the session to cancel operations for.")]
class ClientCapabilities(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# File system capabilities supported by the client.
# Determines which file operations the agent can request.
fs: Annotated[
Optional[FileSystemCapability],
Field(
description="File system capabilities supported by the client.\nDetermines which file operations the agent can request."
),
] = FileSystemCapability(readTextFile=False, writeTextFile=False)
# Whether the Client support all `terminal/*` methods.
terminal: Annotated[
Optional[bool],
Field(description="Whether the Client support all `terminal/*` methods."),
] = False
class ClientErrorMessage(BaseModel):
jsonrpc: Jsonrpc
# JSON RPC Request Id
#
# An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]
#
# The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
#
# [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.
#
# [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.
id: Annotated[
Optional[Union[int, str]],
Field(
description="JSON RPC Request Id\n\nAn identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]\n\nThe Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.\n\n[1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.\n\n[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions."
),
] = None
error: Error
class ClientNotificationMessage(BaseModel):
jsonrpc: Jsonrpc
method: str
params: Optional[Union[CancelNotification, Any]] = None
class TextContentBlock(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
annotations: Optional[Annotations] = None
text: str
type: Literal["text"]
class ImageContentBlock(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
annotations: Optional[Annotations] = None
data: str
mimeType: str
type: Literal["image"]
uri: Optional[str] = None
class AudioContentBlock(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
annotations: Optional[Annotations] = None
data: str
mimeType: str
type: Literal["audio"]
class ResourceContentBlock(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
annotations: Optional[Annotations] = None
description: Optional[str] = None
mimeType: Optional[str] = None
name: str
size: Optional[int] = None
title: Optional[str] = None
type: Literal["resource_link"]
uri: str
class CreateTerminalRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Array of command arguments.
args: Annotated[Optional[List[str]], Field(description="Array of command arguments.")] = None
# The command to execute.
command: Annotated[str, Field(description="The command to execute.")]
# Working directory for the command (absolute path).
cwd: Annotated[
Optional[str],
Field(description="Working directory for the command (absolute path)."),
] = None
# Environment variables for the command.
env: Annotated[
Optional[List[EnvVariable]],
Field(description="Environment variables for the command."),
] = None
# Maximum number of output bytes to retain.
#
# When the limit is exceeded, the Client truncates from the beginning of the output
# to stay within the limit.
#
# The Client MUST ensure truncation happens at a character boundary to maintain valid
# string output, even if this means the retained output is slightly less than the
# specified limit.
outputByteLimit: Annotated[
Optional[int],
Field(
description="Maximum number of output bytes to retain.\n\nWhen the limit is exceeded, the Client truncates from the beginning of the output\nto stay within the limit.\n\nThe Client MUST ensure truncation happens at a character boundary to maintain valid\nstring output, even if this means the retained output is slightly less than the\nspecified limit.",
ge=0,
),
] = None
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
class InitializeRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Capabilities supported by the client.
clientCapabilities: Annotated[
Optional[ClientCapabilities],
Field(description="Capabilities supported by the client."),
] = ClientCapabilities(fs=FileSystemCapability(readTextFile=False, writeTextFile=False), terminal=False)
# Information about the Client name and version sent to the Agent.
#
# Note: in future versions of the protocol, this will be required.
clientInfo: Annotated[
Optional[Implementation],
Field(
description="Information about the Client name and version sent to the Agent.\n\nNote: in future versions of the protocol, this will be required."
),
] = None
# The latest protocol version supported by the client.
protocolVersion: Annotated[
int,
Field(
description="The latest protocol version supported by the client.",
ge=0,
le=65535,
),
]
class InitializeResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Capabilities supported by the agent.
agentCapabilities: Annotated[
Optional[AgentCapabilities],
Field(description="Capabilities supported by the agent."),
] = AgentCapabilities(
loadSession=False,
mcpCapabilities=McpCapabilities(http=False, sse=False),
promptCapabilities=PromptCapabilities(audio=False, embeddedContext=False, image=False),
)
# Information about the Agent name and version sent to the Client.
#
# Note: in future versions of the protocol, this will be required.
agentInfo: Annotated[
Optional[Implementation],
Field(
description="Information about the Agent name and version sent to the Client.\n\nNote: in future versions of the protocol, this will be required."
),
] = None
# Authentication methods supported by the agent.
authMethods: Annotated[
Optional[List[AuthMethod]],
Field(description="Authentication methods supported by the agent."),
] = []
# The protocol version the client specified if supported by the agent,
# or the latest protocol version supported by the agent.
#
# The client should disconnect, if it doesn't support this version.
protocolVersion: Annotated[
int,
Field(
description="The protocol version the client specified if supported by the agent,\nor the latest protocol version supported by the agent.\n\nThe client should disconnect, if it doesn't support this version.",
ge=0,
le=65535,
),
]
class KillTerminalCommandRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
# The ID of the terminal to kill.
terminalId: Annotated[str, Field(description="The ID of the terminal to kill.")]
class LoadSessionRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The working directory for this session.
cwd: Annotated[str, Field(description="The working directory for this session.")]
# List of MCP servers to connect to for this session.
mcpServers: Annotated[
List[Union[HttpMcpServer, SseMcpServer, StdioMcpServer]],
Field(description="List of MCP servers to connect to for this session."),
]
# The ID of the session to load.
sessionId: Annotated[str, Field(description="The ID of the session to load.")]
class PermissionOption(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Hint about the nature of this permission option.
kind: Annotated[PermissionOptionKind, Field(description="Hint about the nature of this permission option.")]
# Human-readable label to display to the user.
name: Annotated[str, Field(description="Human-readable label to display to the user.")]
# Unique identifier for this permission option.
optionId: Annotated[str, Field(description="Unique identifier for this permission option.")]
class PlanEntry(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Human-readable description of what this task aims to accomplish.
content: Annotated[
str,
Field(description="Human-readable description of what this task aims to accomplish."),
]
# The relative importance of this task.
# Used to indicate which tasks are most critical to the overall goal.
priority: Annotated[
PlanEntryPriority,
Field(
description="The relative importance of this task.\nUsed to indicate which tasks are most critical to the overall goal."
),
]
# Current execution status of this task.
status: Annotated[PlanEntryStatus, Field(description="Current execution status of this task.")]
class PromptResponse(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Indicates why the agent stopped processing the turn.
stopReason: Annotated[StopReason, Field(description="Indicates why the agent stopped processing the turn.")]
class ReadTextFileRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# Maximum number of lines to read.
limit: Annotated[Optional[int], Field(description="Maximum number of lines to read.", ge=0)] = None
# Line number to start reading from (1-based).
line: Annotated[
Optional[int],
Field(description="Line number to start reading from (1-based).", ge=0),
] = None
# Absolute path to the file to read.
path: Annotated[str, Field(description="Absolute path to the file to read.")]
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
class ReleaseTerminalRequest(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The session ID for this request.
sessionId: Annotated[str, Field(description="The session ID for this request.")]
# The ID of the terminal to release.
terminalId: Annotated[str, Field(description="The ID of the terminal to release.")]
class SessionMode(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
description: Optional[str] = None
# Unique identifier for a Session Mode.
id: Annotated[str, Field(description="Unique identifier for a Session Mode.")]
name: str
class SessionModeState(BaseModel):
# Extension point for implementations
field_meta: Annotated[
Optional[Any],
Field(alias="_meta", description="Extension point for implementations"),
] = None
# The set of modes that the Agent can operate in
availableModes: Annotated[
List[SessionMode],
Field(description="The set of modes that the Agent can operate in"),
]
# The current mode the Agent is in.
currentModeId: Annotated[str, Field(description="The current mode the Agent is in.")]