diff --git a/CHANGELOG.md b/CHANGELOG.md index a056149a..3802d0b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). ## [Unreleased] +### Changed (v0.2.0 sync) +- **`COPILOT_CLI_PATH` env var support** — when `:cli-path` is not explicitly provided to `client`, the + SDK now checks the `COPILOT_CLI_PATH` environment variable (from the user-supplied `:env` map first, + then the process environment). This aligns with the Node.js SDK behavior. Explicit `:cli-path` takes + precedence; falls back to `"copilot"` from PATH when the env var is not set (upstream PR #925). +- **New `session.custom_agents_updated` event type** — added to `::event-type` spec. Emitted when custom + agents are loaded or reloaded; data includes `agents`, `warnings`, and `errors` fields (upstream PR #916). +- **Extended sub-agent event data** — `subagent.completed` and `subagent.failed` events now carry optional + fields `model`, `total-tool-calls`, `total-tokens`, and `duration-ms`. `skill.completed` events now + carry an optional `description` field. These are passed through as-is in event data maps (upstream PR #916). ## [0.2.0.0] - 2026-03-23 ### Added (v0.2.0 sync) diff --git a/src/github/copilot_sdk/client.clj b/src/github/copilot_sdk/client.clj index cbd77f48..f6268757 100644 --- a/src/github/copilot_sdk/client.clj +++ b/src/github/copilot_sdk/client.clj @@ -119,7 +119,7 @@ "Create a new CopilotClient. Options: - - :cli-path - Path to CLI executable (default: \"copilot\") + - :cli-path - Path to CLI executable (default: COPILOT_CLI_PATH env var, or \"copilot\" from PATH) - :cli-args - Extra arguments for CLI - :cli-url - URL of existing server (e.g., \"localhost:8080\") - :cwd - Working directory for CLI process @@ -183,6 +183,13 @@ opts-with-defaults (cond-> opts (and (:github-token opts) (nil? (:use-logged-in-user? opts))) (assoc :use-logged-in-user? false)) + ;; Resolve COPILOT_CLI_PATH: check user :env map first, then system env. + ;; Applied only when :cli-path is not explicitly set and :cli-url is not set. + env-cli-path (when (and (nil? (:cli-path opts)) (nil? (:cli-url opts))) + (or (get (:env opts) "COPILOT_CLI_PATH") + (System/getenv "COPILOT_CLI_PATH"))) + opts-with-defaults (cond-> opts-with-defaults + env-cli-path (assoc :cli-path env-cli-path)) merged (merge (default-options) opts-with-defaults) child-process? (:is-child-process? opts) cli-url? (boolean (:cli-url opts)) diff --git a/src/github/copilot_sdk/specs.clj b/src/github/copilot_sdk/specs.clj index c6fdb09f..489ed8f7 100644 --- a/src/github/copilot_sdk/specs.clj +++ b/src/github/copilot_sdk/specs.clj @@ -515,7 +515,8 @@ ;; Session status events :copilot/session.tools_updated :copilot/session.background_tasks_changed :copilot/session.skills_loaded :copilot/session.mcp_servers_loaded - :copilot/session.mcp_server_status_changed :copilot/session.extensions_loaded}) + :copilot/session.mcp_server_status_changed :copilot/session.extensions_loaded + :copilot/session.custom_agents_updated}) ;; Session events (s/def ::already-in-use? boolean?)