From ab277a314f0564ef17315a689e1f452c48cbb642 Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Fri, 27 Feb 2026 14:06:48 +0000 Subject: [PATCH 1/3] Port upstream PR #544: add streaming_delta, mode_changed, plan_changed, workspace_file_changed events - Add :copilot/assistant.streaming_delta event type with totalResponseSizeBytes data - Remove total-response-size-bytes from ::assistant.message_delta-data spec (moved to streaming_delta) - Add :copilot/session.mode_changed event type with previousMode/newMode data - Add :copilot/session.plan_changed event type with operation data - Add :copilot/session.workspace_file_changed event type with path/operation data - Fix :copilot/session.task_complete missing from event-types var (was in spec but not exported) - Add all new events to session-events / assistant-events sub-category vars - Update API.md event reference table with new event types and data shapes - Update CHANGELOG.md under [Unreleased] Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 10 +++++++++- doc/reference/API.md | 6 +++++- src/github/copilot_sdk.clj | 12 +++++++++++- src/github/copilot_sdk/specs.clj | 31 +++++++++++++++++++++++++++++-- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db7ec0..080a9db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,15 @@ All notable changes to this project will be documented in this file. This change - `:custom-tool` permission kind — `::permission-kind` spec now includes `:custom-tool`, matching the upstream `PermissionRequest.kind` union type. Permission handlers will receive `{:permission-kind :custom-tool ...}` for SDK-registered custom tool invocations (upstream PR #555). ### Added (upstream PR #544 sync) -- `:copilot/session.task_complete` event type added to `::event-type` spec (from upstream generated session event types). +- `:copilot/session.task_complete` event type added to `::event-type` spec and `event-types` var. Previously it was in the spec but missing from the public `event-types` set (upstream PR #544). +- `:copilot/assistant.streaming_delta` new event type: emitted when the total response size changes during streaming. Data: `{:total-response-size-bytes N}`. Added to `::event-type` spec, `event-types` var, and `assistant-events` var (upstream PR #544). +- `:copilot/session.mode_changed` event type: emitted when the session agent mode changes. Data: `{:previous-mode "...", :new-mode "..."}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. +- `:copilot/session.plan_changed` event type: emitted when the session plan changes. Data: `{:plan-operation "create"|"update"|"delete"}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. +- `:copilot/session.workspace_file_changed` event type: emitted when a workspace file is created or updated. Data: `{:workspace-file-path "...", :workspace-file-operation "create"|"update"}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. +- Data specs for new events: `::session.mode_changed-data`, `::session.plan_changed-data`, `::session.workspace_file_changed-data`, `::session.task_complete-data`, `::assistant.streaming_delta-data`. + +### Changed (upstream PR #544 sync) +- `::assistant.message_delta-data` spec: removed `::total-response-size-bytes` from optional keys. The response size is now delivered via the separate `assistant.streaming_delta` event (upstream PR #544). ### Added (documentation) - Microsoft Foundry Local BYOK provider guide in `doc/auth/byok.md`: quick start example, installation instructions, and connection troubleshooting (upstream PR #461). diff --git a/doc/reference/API.md b/doc/reference/API.md index 52079c1..d7505f8 100644 --- a/doc/reference/API.md +++ b/doc/reference/API.md @@ -861,6 +861,10 @@ copilot/tool-events | `:copilot/session.snapshot_rewind` | Session state rolled back | | `:copilot/session.compaction_start` | Context compaction started (infinite sessions) | | `:copilot/session.compaction_complete` | Context compaction completed (infinite sessions) | +| `:copilot/session.mode_changed` | Session agent mode changed; data: `{:previous-mode "...", :new-mode "..."}` | +| `:copilot/session.plan_changed` | Session plan created/updated/deleted; data: `{:plan-operation "create"\|"update"\|"delete"}` | +| `:copilot/session.workspace_file_changed` | Workspace file created or updated; data: `{:workspace-file-path "...", :workspace-file-operation "create"\|"update"}` | +| `:copilot/session.task_complete` | Task completed by the session agent; data: `{:summary "..."}` (optional) | | `:copilot/skill.invoked` | Skill invocation triggered | | `:copilot/user.message` | User message added | | `:copilot/pending_messages.modified` | Pending message queue updated | @@ -870,6 +874,7 @@ copilot/tool-events | `:copilot/assistant.reasoning_delta` | Streaming reasoning chunk | | `:copilot/assistant.message` | Complete assistant response | | `:copilot/assistant.message_delta` | Streaming response chunk | +| `:copilot/assistant.streaming_delta` | Response size update during streaming; data: `{:total-response-size-bytes N}` | | `:copilot/assistant.turn_end` | Assistant turn completed | | `:copilot/assistant.usage` | Token usage for this turn | | `:copilot/abort` | Current message aborted | @@ -885,7 +890,6 @@ copilot/tool-events | `:copilot/hook.start` | Hook invocation started | | `:copilot/hook.end` | Hook invocation finished | | `:copilot/system.message` | System message emitted | -| `:copilot/session.task_complete` | Task completed by the session agent | ### Example: Handling Events diff --git a/src/github/copilot_sdk.clj b/src/github/copilot_sdk.clj index 37a3bb9..969bf68 100644 --- a/src/github/copilot_sdk.clj +++ b/src/github/copilot_sdk.clj @@ -47,6 +47,10 @@ :copilot/session.context_changed :copilot/session.title_changed :copilot/session.warning + :copilot/session.mode_changed + :copilot/session.plan_changed + :copilot/session.workspace_file_changed + :copilot/session.task_complete :copilot/user.message :copilot/pending_messages.modified :copilot/assistant.turn_start @@ -55,6 +59,7 @@ :copilot/assistant.reasoning_delta :copilot/assistant.message :copilot/assistant.message_delta + :copilot/assistant.streaming_delta :copilot/assistant.turn_end :copilot/assistant.usage :copilot/abort @@ -89,7 +94,11 @@ :copilot/session.shutdown :copilot/session.context_changed :copilot/session.title_changed - :copilot/session.warning}) + :copilot/session.warning + :copilot/session.mode_changed + :copilot/session.plan_changed + :copilot/session.workspace_file_changed + :copilot/session.task_complete}) (def assistant-events "Assistant response events." @@ -99,6 +108,7 @@ :copilot/assistant.reasoning_delta :copilot/assistant.message :copilot/assistant.message_delta + :copilot/assistant.streaming_delta :copilot/assistant.turn_end :copilot/assistant.usage}) diff --git a/src/github/copilot_sdk/specs.clj b/src/github/copilot_sdk/specs.clj index c0f3ee7..756ea70 100644 --- a/src/github/copilot_sdk/specs.clj +++ b/src/github/copilot_sdk/specs.clj @@ -356,10 +356,11 @@ :copilot/session.compaction_start :copilot/session.compaction_complete :copilot/session.shutdown :copilot/session.task_complete :copilot/session.title_changed :copilot/session.warning :copilot/session.context_changed + :copilot/session.mode_changed :copilot/session.plan_changed :copilot/session.workspace_file_changed :copilot/user.message :copilot/pending_messages.modified :copilot/assistant.turn_start :copilot/assistant.intent :copilot/assistant.reasoning :copilot/assistant.reasoning_delta :copilot/assistant.message :copilot/assistant.message_delta - :copilot/assistant.turn_end :copilot/assistant.usage + :copilot/assistant.streaming_delta :copilot/assistant.turn_end :copilot/assistant.usage :copilot/abort :copilot/tool.user_requested :copilot/tool.execution_start :copilot/tool.execution_partial_result :copilot/tool.execution_progress :copilot/tool.execution_complete @@ -389,9 +390,14 @@ (s/keys :req-un [::message-id ::content] :opt-un [::tool-requests ::parent-tool-call-id])) +(s/def ::total-response-size-bytes nat-int?) + (s/def ::assistant.message_delta-data (s/keys :req-un [::message-id ::delta-content] - :opt-un [::total-response-size-bytes ::parent-tool-call-id])) + :opt-un [::parent-tool-call-id])) + +(s/def ::assistant.streaming_delta-data + (s/keys :req-un [::total-response-size-bytes])) (s/def ::tool.execution_start-data (s/keys :req-un [::tool-call-id ::tool-name] @@ -436,6 +442,27 @@ (s/keys :req-un [::cwd] :opt-un [::git-root ::repository ::branch])) +;; Session mode changed event +(s/def ::previous-mode string?) +(s/def ::new-mode string?) +(s/def ::session.mode_changed-data + (s/keys :req-un [::previous-mode ::new-mode])) + +;; Session plan changed event +(s/def ::plan-operation #{"create" "update" "delete"}) +(s/def ::session.plan_changed-data + (s/keys :req-un [::plan-operation])) + +;; Session workspace file changed event +(s/def ::workspace-file-path string?) +(s/def ::workspace-file-operation #{"create" "update"}) +(s/def ::session.workspace_file_changed-data + (s/keys :req-un [::workspace-file-path ::workspace-file-operation])) + +;; Session task complete event +(s/def ::session.task_complete-data + (s/keys :opt-un [::summary])) + ;; Skill invoked event (s/def ::allowed-tools (s/coll-of string?)) From 4fcdb26bda0c4b0992e1f874a0d74c89a29760b4 Mon Sep 17 00:00:00 2001 From: Karl Krukow Date: Fri, 27 Feb 2026 07:55:31 -0800 Subject: [PATCH 2/3] fix: correct field names in plan_changed and workspace_file_changed specs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The specs used invented prefixed field names (plan-operation, workspace-file-path, workspace-file-operation) that don't match the upstream wire format. After the protocol layer's camelCase→kebab-case conversion, upstream sends :operation and :path — not the prefixed variants. Updated specs, docs, and changelog to match. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 4 ++-- doc/reference/API.md | 4 ++-- src/github/copilot_sdk/specs.clj | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 080a9db..a1df992 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,8 @@ All notable changes to this project will be documented in this file. This change - `:copilot/session.task_complete` event type added to `::event-type` spec and `event-types` var. Previously it was in the spec but missing from the public `event-types` set (upstream PR #544). - `:copilot/assistant.streaming_delta` new event type: emitted when the total response size changes during streaming. Data: `{:total-response-size-bytes N}`. Added to `::event-type` spec, `event-types` var, and `assistant-events` var (upstream PR #544). - `:copilot/session.mode_changed` event type: emitted when the session agent mode changes. Data: `{:previous-mode "...", :new-mode "..."}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. -- `:copilot/session.plan_changed` event type: emitted when the session plan changes. Data: `{:plan-operation "create"|"update"|"delete"}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. -- `:copilot/session.workspace_file_changed` event type: emitted when a workspace file is created or updated. Data: `{:workspace-file-path "...", :workspace-file-operation "create"|"update"}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. +- `:copilot/session.plan_changed` event type: emitted when the session plan changes. Data: `{:operation "create"|"update"|"delete"}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. +- `:copilot/session.workspace_file_changed` event type: emitted when a workspace file is created or updated. Data: `{:path "...", :operation "create"|"update"}`. Added to `::event-type` spec, `event-types` var, and `session-events` var. - Data specs for new events: `::session.mode_changed-data`, `::session.plan_changed-data`, `::session.workspace_file_changed-data`, `::session.task_complete-data`, `::assistant.streaming_delta-data`. ### Changed (upstream PR #544 sync) diff --git a/doc/reference/API.md b/doc/reference/API.md index d7505f8..9e2158f 100644 --- a/doc/reference/API.md +++ b/doc/reference/API.md @@ -862,8 +862,8 @@ copilot/tool-events | `:copilot/session.compaction_start` | Context compaction started (infinite sessions) | | `:copilot/session.compaction_complete` | Context compaction completed (infinite sessions) | | `:copilot/session.mode_changed` | Session agent mode changed; data: `{:previous-mode "...", :new-mode "..."}` | -| `:copilot/session.plan_changed` | Session plan created/updated/deleted; data: `{:plan-operation "create"\|"update"\|"delete"}` | -| `:copilot/session.workspace_file_changed` | Workspace file created or updated; data: `{:workspace-file-path "...", :workspace-file-operation "create"\|"update"}` | +| `:copilot/session.plan_changed` | Session plan created/updated/deleted; data: `{:operation "create"\|"update"\|"delete"}` | +| `:copilot/session.workspace_file_changed` | Workspace file created or updated; data: `{:path "...", :operation "create"\|"update"}` | | `:copilot/session.task_complete` | Task completed by the session agent; data: `{:summary "..."}` (optional) | | `:copilot/skill.invoked` | Skill invocation triggered | | `:copilot/user.message` | User message added | diff --git a/src/github/copilot_sdk/specs.clj b/src/github/copilot_sdk/specs.clj index 756ea70..9eac993 100644 --- a/src/github/copilot_sdk/specs.clj +++ b/src/github/copilot_sdk/specs.clj @@ -449,15 +449,14 @@ (s/keys :req-un [::previous-mode ::new-mode])) ;; Session plan changed event -(s/def ::plan-operation #{"create" "update" "delete"}) +(s/def ::operation #{"create" "update" "delete"}) (s/def ::session.plan_changed-data - (s/keys :req-un [::plan-operation])) + (s/keys :req-un [::operation])) ;; Session workspace file changed event -(s/def ::workspace-file-path string?) -(s/def ::workspace-file-operation #{"create" "update"}) +;; ::path already defined above; ::operation reused (superset covers both events) (s/def ::session.workspace_file_changed-data - (s/keys :req-un [::workspace-file-path ::workspace-file-operation])) + (s/keys :req-un [::path ::operation])) ;; Session task complete event (s/def ::session.task_complete-data From c03bd96d3ea73a25cf18bd17e92ab2ced376c60b Mon Sep 17 00:00:00 2001 From: Karl Krukow Date: Fri, 27 Feb 2026 08:28:54 -0800 Subject: [PATCH 3/3] fix: tighten workspace_file_changed operation spec and fix doc escaping Address PR review feedback: - Constrain workspace_file_changed operation to only accept "create"|"update" (not "delete") using s/and, while keeping the correct :operation wire key name - Remove backslash-escaped pipes in API.md table backtick content (GFM renders them literally) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- doc/reference/API.md | 4 ++-- src/github/copilot_sdk/specs.clj | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/reference/API.md b/doc/reference/API.md index 9e2158f..92dc366 100644 --- a/doc/reference/API.md +++ b/doc/reference/API.md @@ -862,8 +862,8 @@ copilot/tool-events | `:copilot/session.compaction_start` | Context compaction started (infinite sessions) | | `:copilot/session.compaction_complete` | Context compaction completed (infinite sessions) | | `:copilot/session.mode_changed` | Session agent mode changed; data: `{:previous-mode "...", :new-mode "..."}` | -| `:copilot/session.plan_changed` | Session plan created/updated/deleted; data: `{:operation "create"\|"update"\|"delete"}` | -| `:copilot/session.workspace_file_changed` | Workspace file created or updated; data: `{:path "...", :operation "create"\|"update"}` | +| `:copilot/session.plan_changed` | Session plan created/updated/deleted; data: `{:operation "create"/"update"/"delete"}` | +| `:copilot/session.workspace_file_changed` | Workspace file created or updated; data: `{:path "...", :operation "create"/"update"}` | | `:copilot/session.task_complete` | Task completed by the session agent; data: `{:summary "..."}` (optional) | | `:copilot/skill.invoked` | Skill invocation triggered | | `:copilot/user.message` | User message added | diff --git a/src/github/copilot_sdk/specs.clj b/src/github/copilot_sdk/specs.clj index 9eac993..6a95fd8 100644 --- a/src/github/copilot_sdk/specs.clj +++ b/src/github/copilot_sdk/specs.clj @@ -454,9 +454,10 @@ (s/keys :req-un [::operation])) ;; Session workspace file changed event -;; ::path already defined above; ::operation reused (superset covers both events) +;; ::path already defined above; ::operation reused but constrained to create/update (s/def ::session.workspace_file_changed-data - (s/keys :req-un [::path ::operation])) + (s/and (s/keys :req-un [::path ::operation]) + #(contains? #{"create" "update"} (:operation %)))) ;; Session task complete event (s/def ::session.task_complete-data