diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db7ec0..a1df992 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: `{: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) +- `::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..92dc366 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: `{: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 | | `: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..6a95fd8 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 ::operation #{"create" "update" "delete"}) +(s/def ::session.plan_changed-data + (s/keys :req-un [::operation])) + +;; Session workspace file changed event +;; ::path already defined above; ::operation reused but constrained to create/update +(s/def ::session.workspace_file_changed-data + (s/and (s/keys :req-un [::path ::operation]) + #(contains? #{"create" "update"} (: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?))