diff --git a/dotnet/src/Generated/SessionEvents.cs b/dotnet/src/Generated/SessionEvents.cs index 716f2ba3..81d6b3e0 100644 --- a/dotnet/src/Generated/SessionEvents.cs +++ b/dotnet/src/Generated/SessionEvents.cs @@ -6,7 +6,7 @@ // // Generated from: @github/copilot/session-events.schema.json // Generated by: scripts/generate-session-types.ts -// Generated at: 2026-01-16T00:52:52.781Z +// Generated at: 2026-01-20T04:18:06.775Z // // To update these types: // 1. Update the schema in copilot-agent-runtime @@ -78,7 +78,7 @@ internal class SessionEventConverter : JsonConverter throw new JsonException("Missing 'type' discriminator property"); if (!TypeMap.TryGetValue(typeProp, out var targetType)) - return null; // Ignore unknown event types for forward compatibility + throw new JsonException($"Unknown event type: {typeProp}"); // Deserialize to the concrete type without using this converter (to avoid recursion) return (SessionEvent?)obj.Deserialize(targetType, SerializerOptions.WithoutConverter); @@ -505,6 +505,10 @@ public partial class SessionStartData [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("selectedModel")] public string SelectedModel { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("context")] + public SessionStartDataContext? Context { get; set; } } public partial class SessionResumeData @@ -514,6 +518,10 @@ public partial class SessionResumeData [JsonPropertyName("eventCount")] public double EventCount { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("context")] + public SessionResumeDataContext? Context { get; set; } } public partial class SessionErrorData @@ -969,6 +977,42 @@ public partial class SystemMessageData public SystemMessageDataMetadata? Metadata { get; set; } } + public partial class SessionStartDataContext + { + [JsonPropertyName("cwd")] + public string Cwd { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("gitRoot")] + public string GitRoot { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("repository")] + public string Repository { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("branch")] + public string Branch { get; set; } + } + + public partial class SessionResumeDataContext + { + [JsonPropertyName("cwd")] + public string Cwd { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("gitRoot")] + public string GitRoot { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("repository")] + public string Repository { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("branch")] + public string Branch { get; set; } + } + public partial class SessionHandoffDataRepository { [JsonPropertyName("owner")] @@ -1017,6 +1061,10 @@ public partial class AssistantMessageDataToolRequestsItem [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("arguments")] public object Arguments { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("type")] + public AssistantMessageDataToolRequestsItemType? Type { get; set; } } public partial class ToolExecutionCompleteDataResult @@ -1068,6 +1116,12 @@ public enum UserMessageDataAttachmentsItemType Directory, } + public enum AssistantMessageDataToolRequestsItemType + { + Function, + Custom, + } + public enum SystemMessageDataRole { System, diff --git a/go/generated/session_events.go b/go/generated/session_events.go index cdd21189..6445846b 100644 --- a/go/generated/session_events.go +++ b/go/generated/session_events.go @@ -2,7 +2,7 @@ // // Generated from: @github/copilot/session-events.schema.json // Generated by: scripts/generate-session-types.ts -// Generated at: 2026-01-16T00:52:52.011Z +// Generated at: 2026-01-20T04:18:06.667Z // // To update these types: // 1. Update the schema in copilot-agent-runtime @@ -42,6 +42,7 @@ type SessionEvent struct { } type Data struct { + Context *ContextUnion `json:"context"` CopilotVersion *string `json:"copilotVersion,omitempty"` Producer *string `json:"producer,omitempty"` SelectedModel *string `json:"selectedModel,omitempty"` @@ -56,7 +57,6 @@ type Data struct { InfoType *string `json:"infoType,omitempty"` NewModel *string `json:"newModel,omitempty"` PreviousModel *string `json:"previousModel,omitempty"` - Context *string `json:"context,omitempty"` HandoffTime *time.Time `json:"handoffTime,omitempty"` RemoteSessionID *string `json:"remoteSessionId,omitempty"` Repository *Repository `json:"repository,omitempty"` @@ -137,6 +137,13 @@ type CompactionTokensUsed struct { Output float64 `json:"output"` } +type ContextClass struct { + Branch *string `json:"branch,omitempty"` + Cwd string `json:"cwd"` + GitRoot *string `json:"gitRoot,omitempty"` + Repository *string `json:"repository,omitempty"` +} + type ErrorClass struct { Code *string `json:"code,omitempty"` Message string `json:"message"` @@ -170,9 +177,10 @@ type Result struct { } type ToolRequest struct { - Arguments interface{} `json:"arguments"` - Name string `json:"name"` - ToolCallID string `json:"toolCallId"` + Arguments interface{} `json:"arguments"` + Name string `json:"name"` + ToolCallID string `json:"toolCallId"` + Type *ToolRequestType `json:"type,omitempty"` } type AttachmentType string @@ -196,6 +204,13 @@ const ( Remote SourceType = "remote" ) +type ToolRequestType string + +const ( + Custom ToolRequestType = "custom" + Function ToolRequestType = "function" +) + type SessionEventType string const ( @@ -234,6 +249,28 @@ const ( UserMessage SessionEventType = "user.message" ) +type ContextUnion struct { + ContextClass *ContextClass + String *string +} + +func (x *ContextUnion) UnmarshalJSON(data []byte) error { + x.ContextClass = nil + var c ContextClass + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.ContextClass = &c + } + return nil +} + +func (x *ContextUnion) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.ContextClass != nil, x.ContextClass, false, nil, false, nil, false) +} + type ErrorUnion struct { ErrorClass *ErrorClass String *string diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index 15ea4386..436217c4 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.8", "license": "MIT", "dependencies": { - "@github/copilot": "^0.0.384", + "@github/copilot": "^0.0.387", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.5" }, @@ -662,9 +662,9 @@ } }, "node_modules/@github/copilot": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-0.0.384.tgz", - "integrity": "sha512-kcM+H33oPgYAsnu5ESd5IS3zw2HnV26+D/ZRB42EUF0f4FfITZchRBYguZLgk2g+7NCDHHM9vZ/Kg7699byEaA==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-0.0.387.tgz", + "integrity": "sha512-J/KyJE4089ZzfFLfUPt13QDsY2rN+WuVVt8gm0txlKfl4saBOSVgbZdmrPkmD9r/mEK5GQYfM/1qtJ4cZO6lyg==", "license": "SEE LICENSE IN LICENSE.md", "bin": { "copilot": "npm-loader.js" @@ -673,18 +673,18 @@ "node": ">=22" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "0.0.384", - "@github/copilot-darwin-x64": "0.0.384", - "@github/copilot-linux-arm64": "0.0.384", - "@github/copilot-linux-x64": "0.0.384", - "@github/copilot-win32-arm64": "0.0.384", - "@github/copilot-win32-x64": "0.0.384" + "@github/copilot-darwin-arm64": "0.0.387", + "@github/copilot-darwin-x64": "0.0.387", + "@github/copilot-linux-arm64": "0.0.387", + "@github/copilot-linux-x64": "0.0.387", + "@github/copilot-win32-arm64": "0.0.387", + "@github/copilot-win32-x64": "0.0.387" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-0.0.384.tgz", - "integrity": "sha512-lSJxgCgFaIz+6RkT/SpXBuysKQru6xCF0prnCZp2tvywOmulsujtbCndBPFCpaUlm7XQh87TZ3RSrkzdisLtjQ==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-0.0.387.tgz", + "integrity": "sha512-Ci+UF2JQm0+cdJMhZQ8RN5eeQrWyc1sRPYL6NrkEmLdQ7K+EA2vgkVsnYEogsIOWmlAUjy+NhDiqy/RApHq3OA==", "cpu": [ "arm64" ], @@ -698,9 +698,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-0.0.384.tgz", - "integrity": "sha512-mkkgGQn/YMcrBPkaOsmi4JrM/ItSzC1eIBFitiqCw/+LbWEQTVqAwdQLrjo2QtFoGgs+IMJNAZbnnAe6DQ20Eg==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-0.0.387.tgz", + "integrity": "sha512-fSOu8813KbhrTuFnc1OhrU6p071RBcpaG6FpKAVivSaWL42Wj9kocTI+CnlO5TFrhp78NRy433gs/t2ilGIilQ==", "cpu": [ "x64" ], @@ -714,9 +714,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-0.0.384.tgz", - "integrity": "sha512-TdWNkmEKHXrxLgcnmxtUaem+0eQbggGqxcUiD0jYMnJQ5HWgap1ARHF4To5CnjR7EVBRlxo3ikDlWnHi9dwLqA==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-0.0.387.tgz", + "integrity": "sha512-/q99VVrDqS/TlKU88deTLIa+2NX3kLLVjj3xfR+RaPfmSKdl0P1Vc4185DJCBsZOzU2TjXPzRW0pcXtoxh2rag==", "cpu": [ "arm64" ], @@ -730,9 +730,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-0.0.384.tgz", - "integrity": "sha512-rl1IEtd+xGPRDLqJJ4NGd3JHvbR48zf6qUFgVb8Si6LGXNuRl9Wiol97JxOVpAKCKOjYdHMSWxPu5TmQfJXDuA==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-0.0.387.tgz", + "integrity": "sha512-inDXQQqKAdWYtXna07GBogKT7KtZr7P8N1BITeHpqiR4/Nqqfc65HjAUNnIK1a9Jc70isU5COG4Bn03Jhvtg/Q==", "cpu": [ "x64" ], @@ -746,9 +746,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-0.0.384.tgz", - "integrity": "sha512-mQXEMqZtNznhkxD0vVIvvvqduJWSpsyHxgL/5R598vCcCM5DLV8khNqW6DRHep5gi39tp96Wo9HYl4wytdMHpA==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-0.0.387.tgz", + "integrity": "sha512-wKQjefsQ+AZEhO354pKUKTZOugY9D7AT7fi7yygMHitMwEwMhvqruQ5gWCQ6bC3tMBt7k9pnp1H44KomS3hsYw==", "cpu": [ "arm64" ], @@ -762,9 +762,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "0.0.384", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-0.0.384.tgz", - "integrity": "sha512-emFbcsqGuut1aU3HfeMB1HIW3e2nVz21SepQREGBdnDwJSZFPGguPmHHvkc/TsdAef8cId8QBQj/FtSfaxlZWA==", + "version": "0.0.387", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-0.0.387.tgz", + "integrity": "sha512-aTNKouXLoq6hEtdDEFFT1tmEztymLooRV3uA0JvYakM3dcNETqOfl6HS1FP4VUBJ4oaC6oakF3p3dJkPhcKOTg==", "cpu": [ "x64" ], diff --git a/nodejs/package.json b/nodejs/package.json index f3c87e47..7c38ea3d 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -40,7 +40,7 @@ "author": "GitHub", "license": "MIT", "dependencies": { - "@github/copilot": "^0.0.384", + "@github/copilot": "^0.0.387", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.5" }, diff --git a/nodejs/src/generated/session-events.ts b/nodejs/src/generated/session-events.ts index ea8ed7ad..da8aa4e6 100644 --- a/nodejs/src/generated/session-events.ts +++ b/nodejs/src/generated/session-events.ts @@ -3,7 +3,7 @@ * * Generated from: @github/copilot/session-events.schema.json * Generated by: scripts/generate-session-types.ts - * Generated at: 2026-01-16T00:52:51.450Z + * Generated at: 2026-01-20T04:18:06.227Z * * To update these types: * 1. Update the schema in copilot-agent-runtime @@ -24,6 +24,12 @@ export type SessionEvent = copilotVersion: string; startTime: string; selectedModel?: string; + context?: { + cwd: string; + gitRoot?: string; + repository?: string; + branch?: string; + }; }; } | { @@ -35,6 +41,12 @@ export type SessionEvent = data: { resumeTime: string; eventCount: number; + context?: { + cwd: string; + gitRoot?: string; + repository?: string; + branch?: string; + }; }; } | { @@ -237,6 +249,7 @@ export type SessionEvent = toolCallId: string; name: string; arguments?: unknown; + type?: "function" | "custom"; }[]; parentToolCallId?: string; }; diff --git a/python/copilot/generated/session_events.py b/python/copilot/generated/session_events.py index 73acf726..fea87957 100644 --- a/python/copilot/generated/session_events.py +++ b/python/copilot/generated/session_events.py @@ -3,7 +3,7 @@ Generated from: @github/copilot/session-events.schema.json Generated by: scripts/generate-session-types.ts -Generated at: 2026-01-16T00:52:51.909Z +Generated at: 2026-01-20T04:18:06.607Z To update these types: 1. Update the schema in copilot-agent-runtime @@ -129,6 +129,34 @@ def to_dict(self) -> dict: return result +@dataclass +class ContextClass: + cwd: str + branch: Optional[str] = None + git_root: Optional[str] = None + repository: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ContextClass': + assert isinstance(obj, dict) + cwd = from_str(obj.get("cwd")) + branch = from_union([from_str, from_none], obj.get("branch")) + git_root = from_union([from_str, from_none], obj.get("gitRoot")) + repository = from_union([from_str, from_none], obj.get("repository")) + return ContextClass(cwd, branch, git_root, repository) + + def to_dict(self) -> dict: + result: dict = {} + result["cwd"] = from_str(self.cwd) + if self.branch is not None: + result["branch"] = from_union([from_str, from_none], self.branch) + if self.git_root is not None: + result["gitRoot"] = from_union([from_str, from_none], self.git_root) + if self.repository is not None: + result["repository"] = from_union([from_str, from_none], self.repository) + return result + + @dataclass class ErrorClass: message: str @@ -261,11 +289,17 @@ class SourceType(Enum): REMOTE = "remote" +class ToolRequestType(Enum): + CUSTOM = "custom" + FUNCTION = "function" + + @dataclass class ToolRequest: name: str tool_call_id: str arguments: Any = None + type: Optional[ToolRequestType] = None @staticmethod def from_dict(obj: Any) -> 'ToolRequest': @@ -273,7 +307,8 @@ def from_dict(obj: Any) -> 'ToolRequest': name = from_str(obj.get("name")) tool_call_id = from_str(obj.get("toolCallId")) arguments = obj.get("arguments") - return ToolRequest(name, tool_call_id, arguments) + type = from_union([ToolRequestType, from_none], obj.get("type")) + return ToolRequest(name, tool_call_id, arguments, type) def to_dict(self) -> dict: result: dict = {} @@ -281,11 +316,14 @@ def to_dict(self) -> dict: result["toolCallId"] = from_str(self.tool_call_id) if self.arguments is not None: result["arguments"] = self.arguments + if self.type is not None: + result["type"] = from_union([lambda x: to_enum(ToolRequestType, x), from_none], self.type) return result @dataclass class Data: + context: Optional[Union[ContextClass, str]] = None copilot_version: Optional[str] = None producer: Optional[str] = None selected_model: Optional[str] = None @@ -300,7 +338,6 @@ class Data: info_type: Optional[str] = None new_model: Optional[str] = None previous_model: Optional[str] = None - context: Optional[str] = None handoff_time: Optional[datetime] = None remote_session_id: Optional[str] = None repository: Optional[Repository] = None @@ -371,6 +408,7 @@ class Data: @staticmethod def from_dict(obj: Any) -> 'Data': assert isinstance(obj, dict) + context = from_union([ContextClass.from_dict, from_str, from_none], obj.get("context")) copilot_version = from_union([from_str, from_none], obj.get("copilotVersion")) producer = from_union([from_str, from_none], obj.get("producer")) selected_model = from_union([from_str, from_none], obj.get("selectedModel")) @@ -385,7 +423,6 @@ def from_dict(obj: Any) -> 'Data': info_type = from_union([from_str, from_none], obj.get("infoType")) new_model = from_union([from_str, from_none], obj.get("newModel")) previous_model = from_union([from_str, from_none], obj.get("previousModel")) - context = from_union([from_str, from_none], obj.get("context")) handoff_time = from_union([from_datetime, from_none], obj.get("handoffTime")) remote_session_id = from_union([from_str, from_none], obj.get("remoteSessionId")) repository = from_union([Repository.from_dict, from_none], obj.get("repository")) @@ -452,10 +489,12 @@ def from_dict(obj: Any) -> 'Data': metadata = from_union([Metadata.from_dict, from_none], obj.get("metadata")) name = from_union([from_str, from_none], obj.get("name")) role = from_union([Role, from_none], obj.get("role")) - 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) + 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) def to_dict(self) -> dict: result: dict = {} + if self.context is not None: + result["context"] = from_union([lambda x: to_class(ContextClass, x), from_str, from_none], self.context) if self.copilot_version is not None: result["copilotVersion"] = from_union([from_str, from_none], self.copilot_version) if self.producer is not None: @@ -484,8 +523,6 @@ def to_dict(self) -> dict: result["newModel"] = from_union([from_str, from_none], self.new_model) if self.previous_model is not None: result["previousModel"] = from_union([from_str, from_none], self.previous_model) - if self.context is not None: - result["context"] = from_union([from_str, from_none], self.context) if self.handoff_time is not None: result["handoffTime"] = from_union([lambda x: x.isoformat(), from_none], self.handoff_time) if self.remote_session_id is not None: @@ -655,7 +692,14 @@ class SessionEventType(Enum): TOOL_EXECUTION_START = "tool.execution_start" TOOL_USER_REQUESTED = "tool.user_requested" USER_MESSAGE = "user.message" - UNKNOWN = "unknown" # For forward compatibility with new event types + # UNKNOWN is used for forward compatibility - new event types from the server + # will map to this value instead of raising an error + UNKNOWN = "unknown" + + @classmethod + def _missing_(cls, value: object) -> "SessionEventType": + """Handle unknown event types gracefully for forward compatibility.""" + return cls.UNKNOWN @dataclass @@ -673,10 +717,7 @@ def from_dict(obj: Any) -> 'SessionEvent': data = Data.from_dict(obj.get("data")) id = UUID(obj.get("id")) timestamp = from_datetime(obj.get("timestamp")) - try: - type = SessionEventType(obj.get("type")) - except ValueError: - type = SessionEventType.UNKNOWN # Forward compatibility + type = SessionEventType(obj.get("type")) ephemeral = from_union([from_bool, from_none], obj.get("ephemeral")) parent_id = from_union([from_none, lambda x: UUID(x)], obj.get("parentId")) return SessionEvent(data, id, timestamp, type, ephemeral, parent_id)