33
44Generated from: @github/copilot/session-events.schema.json
55Generated by: scripts/generate-session-types.ts
6- Generated at: 2026-01-16T00:52:51.909Z
6+ Generated at: 2026-01-20T04:18:06.607Z
77
88To update these types:
991. Update the schema in copilot-agent-runtime
@@ -129,6 +129,34 @@ def to_dict(self) -> dict:
129129 return result
130130
131131
132+ @dataclass
133+ class ContextClass :
134+ cwd : str
135+ branch : Optional [str ] = None
136+ git_root : Optional [str ] = None
137+ repository : Optional [str ] = None
138+
139+ @staticmethod
140+ def from_dict (obj : Any ) -> 'ContextClass' :
141+ assert isinstance (obj , dict )
142+ cwd = from_str (obj .get ("cwd" ))
143+ branch = from_union ([from_str , from_none ], obj .get ("branch" ))
144+ git_root = from_union ([from_str , from_none ], obj .get ("gitRoot" ))
145+ repository = from_union ([from_str , from_none ], obj .get ("repository" ))
146+ return ContextClass (cwd , branch , git_root , repository )
147+
148+ def to_dict (self ) -> dict :
149+ result : dict = {}
150+ result ["cwd" ] = from_str (self .cwd )
151+ if self .branch is not None :
152+ result ["branch" ] = from_union ([from_str , from_none ], self .branch )
153+ if self .git_root is not None :
154+ result ["gitRoot" ] = from_union ([from_str , from_none ], self .git_root )
155+ if self .repository is not None :
156+ result ["repository" ] = from_union ([from_str , from_none ], self .repository )
157+ return result
158+
159+
132160@dataclass
133161class ErrorClass :
134162 message : str
@@ -261,31 +289,41 @@ class SourceType(Enum):
261289 REMOTE = "remote"
262290
263291
292+ class ToolRequestType (Enum ):
293+ CUSTOM = "custom"
294+ FUNCTION = "function"
295+
296+
264297@dataclass
265298class ToolRequest :
266299 name : str
267300 tool_call_id : str
268301 arguments : Any = None
302+ type : Optional [ToolRequestType ] = None
269303
270304 @staticmethod
271305 def from_dict (obj : Any ) -> 'ToolRequest' :
272306 assert isinstance (obj , dict )
273307 name = from_str (obj .get ("name" ))
274308 tool_call_id = from_str (obj .get ("toolCallId" ))
275309 arguments = obj .get ("arguments" )
276- return ToolRequest (name , tool_call_id , arguments )
310+ type = from_union ([ToolRequestType , from_none ], obj .get ("type" ))
311+ return ToolRequest (name , tool_call_id , arguments , type )
277312
278313 def to_dict (self ) -> dict :
279314 result : dict = {}
280315 result ["name" ] = from_str (self .name )
281316 result ["toolCallId" ] = from_str (self .tool_call_id )
282317 if self .arguments is not None :
283318 result ["arguments" ] = self .arguments
319+ if self .type is not None :
320+ result ["type" ] = from_union ([lambda x : to_enum (ToolRequestType , x ), from_none ], self .type )
284321 return result
285322
286323
287324@dataclass
288325class Data :
326+ context : Optional [Union [ContextClass , str ]] = None
289327 copilot_version : Optional [str ] = None
290328 producer : Optional [str ] = None
291329 selected_model : Optional [str ] = None
@@ -300,7 +338,6 @@ class Data:
300338 info_type : Optional [str ] = None
301339 new_model : Optional [str ] = None
302340 previous_model : Optional [str ] = None
303- context : Optional [str ] = None
304341 handoff_time : Optional [datetime ] = None
305342 remote_session_id : Optional [str ] = None
306343 repository : Optional [Repository ] = None
@@ -371,6 +408,7 @@ class Data:
371408 @staticmethod
372409 def from_dict (obj : Any ) -> 'Data' :
373410 assert isinstance (obj , dict )
411+ context = from_union ([ContextClass .from_dict , from_str , from_none ], obj .get ("context" ))
374412 copilot_version = from_union ([from_str , from_none ], obj .get ("copilotVersion" ))
375413 producer = from_union ([from_str , from_none ], obj .get ("producer" ))
376414 selected_model = from_union ([from_str , from_none ], obj .get ("selectedModel" ))
@@ -385,7 +423,6 @@ def from_dict(obj: Any) -> 'Data':
385423 info_type = from_union ([from_str , from_none ], obj .get ("infoType" ))
386424 new_model = from_union ([from_str , from_none ], obj .get ("newModel" ))
387425 previous_model = from_union ([from_str , from_none ], obj .get ("previousModel" ))
388- context = from_union ([from_str , from_none ], obj .get ("context" ))
389426 handoff_time = from_union ([from_datetime , from_none ], obj .get ("handoffTime" ))
390427 remote_session_id = from_union ([from_str , from_none ], obj .get ("remoteSessionId" ))
391428 repository = from_union ([Repository .from_dict , from_none ], obj .get ("repository" ))
@@ -452,10 +489,12 @@ def from_dict(obj: Any) -> 'Data':
452489 metadata = from_union ([Metadata .from_dict , from_none ], obj .get ("metadata" ))
453490 name = from_union ([from_str , from_none ], obj .get ("name" ))
454491 role = from_union ([Role , from_none ], obj .get ("role" ))
455- return Data (copilot_version , producer , selected_model , session_id , start_time , version , event_count , resume_time , error_type , message , stack , info_type , new_model , previous_model , context , handoff_time , remote_session_id , repository , source_type , summary , messages_removed_during_truncation , performed_by , post_truncation_messages_length , post_truncation_tokens_in_messages , pre_truncation_messages_length , pre_truncation_tokens_in_messages , token_limit , tokens_removed_during_truncation , current_tokens , messages_length , compaction_tokens_used , error , messages_removed , post_compaction_tokens , pre_compaction_messages_length , pre_compaction_tokens , success , summary_content , tokens_removed , attachments , content , source , transformed_content , turn_id , intent , reasoning_id , delta_content , message_id , parent_tool_call_id , tool_requests , total_response_size_bytes , api_call_id , cache_read_tokens , cache_write_tokens , cost , duration , initiator , input_tokens , model , output_tokens , provider_call_id , quota_snapshots , reason , arguments , tool_call_id , tool_name , partial_output , is_user_requested , result , tool_telemetry , agent_description , agent_display_name , agent_name , tools , hook_invocation_id , hook_type , input , output , metadata , name , role )
492+ return Data (context , copilot_version , producer , selected_model , session_id , start_time , version , event_count , resume_time , error_type , message , stack , info_type , new_model , previous_model , handoff_time , remote_session_id , repository , source_type , summary , messages_removed_during_truncation , performed_by , post_truncation_messages_length , post_truncation_tokens_in_messages , pre_truncation_messages_length , pre_truncation_tokens_in_messages , token_limit , tokens_removed_during_truncation , current_tokens , messages_length , compaction_tokens_used , error , messages_removed , post_compaction_tokens , pre_compaction_messages_length , pre_compaction_tokens , success , summary_content , tokens_removed , attachments , content , source , transformed_content , turn_id , intent , reasoning_id , delta_content , message_id , parent_tool_call_id , tool_requests , total_response_size_bytes , api_call_id , cache_read_tokens , cache_write_tokens , cost , duration , initiator , input_tokens , model , output_tokens , provider_call_id , quota_snapshots , reason , arguments , tool_call_id , tool_name , partial_output , is_user_requested , result , tool_telemetry , agent_description , agent_display_name , agent_name , tools , hook_invocation_id , hook_type , input , output , metadata , name , role )
456493
457494 def to_dict (self ) -> dict :
458495 result : dict = {}
496+ if self .context is not None :
497+ result ["context" ] = from_union ([lambda x : to_class (ContextClass , x ), from_str , from_none ], self .context )
459498 if self .copilot_version is not None :
460499 result ["copilotVersion" ] = from_union ([from_str , from_none ], self .copilot_version )
461500 if self .producer is not None :
@@ -484,8 +523,6 @@ def to_dict(self) -> dict:
484523 result ["newModel" ] = from_union ([from_str , from_none ], self .new_model )
485524 if self .previous_model is not None :
486525 result ["previousModel" ] = from_union ([from_str , from_none ], self .previous_model )
487- if self .context is not None :
488- result ["context" ] = from_union ([from_str , from_none ], self .context )
489526 if self .handoff_time is not None :
490527 result ["handoffTime" ] = from_union ([lambda x : x .isoformat (), from_none ], self .handoff_time )
491528 if self .remote_session_id is not None :
@@ -655,7 +692,6 @@ class SessionEventType(Enum):
655692 TOOL_EXECUTION_START = "tool.execution_start"
656693 TOOL_USER_REQUESTED = "tool.user_requested"
657694 USER_MESSAGE = "user.message"
658- UNKNOWN = "unknown" # For forward compatibility with new event types
659695
660696
661697@dataclass
@@ -673,10 +709,7 @@ def from_dict(obj: Any) -> 'SessionEvent':
673709 data = Data .from_dict (obj .get ("data" ))
674710 id = UUID (obj .get ("id" ))
675711 timestamp = from_datetime (obj .get ("timestamp" ))
676- try :
677- type = SessionEventType (obj .get ("type" ))
678- except ValueError :
679- type = SessionEventType .UNKNOWN # Forward compatibility
712+ type = SessionEventType (obj .get ("type" ))
680713 ephemeral = from_union ([from_bool , from_none ], obj .get ("ephemeral" ))
681714 parent_id = from_union ([from_none , lambda x : UUID (x )], obj .get ("parentId" ))
682715 return SessionEvent (data , id , timestamp , type , ephemeral , parent_id )
0 commit comments