Port upstream v0.2.1: commands, UI elicitation, COPILOT_CLI_PATH#70
Merged
Port upstream v0.2.1: commands, UI elicitation, COPILOT_CLI_PATH#70
Conversation
Add commands support, UI elicitation convenience API, COPILOT_CLI_PATH env var fallback, and session.custom_agents_updated event type. ## Commands - :commands option in session config for slash commands - command.execute event routing via handlePendingCommand RPC - Integration tests for wire format, routing, errors ## UI Elicitation - capabilities accessor from session create/resume response - elicitation-supported? predicate - ui-elicitation! promoted from experimental, now asserts support ## Other - COPILOT_CLI_PATH env var fallback for CLI path resolution - session.custom_agents_updated event type - Version bump to 0.2.1.0 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Ports upstream copilot-sdk changes from v0.2.0 → v0.2.1-preview.1 into the Clojure SDK, adding new session features (commands, UI elicitation helpers) and a CLI path resolution fallback.
Changes:
- Add per-session slash command registration (
:commands) and routecommand.executev3 broadcast events to local handlers withhandlePendingCommandRPC responses. - Add UI elicitation convenience APIs (
capabilities,elicitation-supported?,confirm!,select!,input!) and promoteui-elicitation!to non-experimental with support assertions. - Add
COPILOT_CLI_PATHenvironment-variable fallback for resolving the CLI executable when:cli-path/:cli-urlaren’t explicitly provided, plus version/docs/changelog updates.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
test/github/copilot_sdk/mock_server.clj |
Adds mock support for session.commands.handlePendingCommand and allows request hooks to merge response data. |
test/github/copilot_sdk/integration_test.clj |
Adds integration coverage for commands-on-wire, v3 command execution routing/errors, and capabilities/elicitation guards. |
src/github/copilot_sdk/specs.clj |
Introduces new specs for commands, capabilities, and elicitation/input options; expands session config keys; adds new event type. |
src/github/copilot_sdk/session.clj |
Stores command handlers + capabilities in session state; implements v3 command execution handler and UI elicitation helpers. |
src/github/copilot_sdk/instrument.clj |
Adds fdefs/instrumentation entries for new public session APIs and tightens ui-elicitation! arg spec. |
src/github/copilot_sdk/client.clj |
Adds COPILOT_CLI_PATH fallback, wires :commands onto create/resume params, and routes v3 command.execute broadcast events. |
src/github/copilot_sdk.clj |
Exposes new UI elicitation functions from the public facade and adds session.custom_agents_updated to event sets. |
doc/reference/API.md |
Documents commands and UI elicitation APIs; updates client option docs for COPILOT_CLI_PATH fallback; adds new event type. |
build.clj |
Bumps library version to 0.2.1.0. |
README.md |
Updates dependency version to 0.2.1.0. |
CHANGELOG.md |
Adds v0.2.1 sync notes under [Unreleased]. |
Comments suppressed due to low confidence (2)
test/github/copilot_sdk/integration_test.clj:1320
- Same issue here:
(.await rpc-latch ...)return value isn’t asserted. If the latch times out, the test may still pass depending on later assertions; assert the boolean result so the test fails fast on timeout.
(.await rpc-latch 5 java.util.concurrent.TimeUnit/SECONDS)
(let [cmd-rpcs (filter #(= "session.commands.handlePendingCommand" (:method %)) @requests)]
(is (= 1 (count cmd-rpcs)))
test/github/copilot_sdk/integration_test.clj:1290
- Same issue here:
(.await rpc-latch ...)return value isn’t asserted, so a timeout won’t necessarily fail the test. Assert the return value to make the test reliably catch missing/late RPCs.
(.await rpc-latch 5 java.util.concurrent.TimeUnit/SECONDS)
(let [cmd-rpcs (filter #(= "session.commands.handlePendingCommand" (:method %)) @requests)]
(is (= 1 (count cmd-rpcs)))
- Fix input! to multi-arity [session message] / [session message opts] instead of varargs, fixing delegate forwarding (review #2993144101) - Add non-blank validation to ::command-definition via s/and predicate (review #2993144151) - Fix ::elicitation-content to use keyword keys matching wire->clj output (review #2993144169) - Fix ::elicitation-action to use strings matching wire format (review #2993144218) - Fix ::elicitation-result to use ::action/::content key names (review #2993144218) - Assert .await return value in 3 command integration tests (review #2993144181) - Fix effective-env to merge system env with :env overrides (review #2993144245) - Fix API.md elicitation action values to use strings not keywords (review #2993144257) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/github/copilot_sdk/client.clj:1292
- Same as above:
wire-commandsfor resume currently emits:description nilfor commands without descriptions, which will serialize tonull. Prefer omitting:descriptionwhen absent to keep wire payloads consistent with other optional fields and reduce risk of protocol validation differences.
wire-commands (when-let [cmds (:commands config)]
(mapv (fn [c] {:name (:name c)
:description (:description c)})
cmds))]
- Fix ::session-capabilities spec to use ::ui key matching wire shape - Fix input! docs to show opts map instead of keyword args - Omit :description from wire-commands when nil (both create and resume) - Update test assertion for command without description Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Make mock server response merge opt-in via ::merge-response sentinel key, preventing accidental mutation from spy hooks - Remove dead register-commands! function (command handlers already indexed in create-session) - Update capabilities test to use ::mock/merge-response Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix mock server hook comment to match opt-in merge behavior - Add guard against non-map ::merge-response values with clear error Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add (s/def ::message ::non-blank-string) for elicitation params - Add (s/def ::default string?) for input options - Remove duplicate ::requested-schema definition Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prevents indefinite blocking when a command handler returns a slow/stuck core.async channel. Reuses tool-timeout-ms (default 120s). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Guard handle-v3-command-execute! on both request-id and command-name - Include :session-id in all handlePendingCommand RPC payloads for consistency with permission/tool v3 handlers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port upstream PR #900 change: session.handoff event data now includes optional :host and :remote-session-id fields. Adds ::session.handoff-data and ::remote-session-id specs. Updates API.md event table with data shape documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 26, 2026
Closed
Closed
github-actions Bot
pushed a commit
that referenced
this pull request
Mar 26, 2026
Document the new commands and UI elicitation capabilities from v0.2.1 (PR #70) in the README key features list. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 26, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port upstream copilot-sdk changes from v0.2.0 → v0.2.1-preview.1 (PR #906 and related).
Changes
Commands Support
:commandsoption in session config for registering slash commands{:name "deploy" :description "Deploy" :command-handler (fn [ctx] ...)}command.executebroadcast event routing withhandlePendingCommandRPC callbackUI Elicitation Convenience API
capabilities— accessor for host capabilities from session create/resume responseelicitation-supported?— predicate checking{:ui {:elicitation true}}confirm!— boolean confirmation dialogselect!— selection from options, returns string or nilinput!— text input with options, returns string or nilui-elicitation!promoted from experimental, now asserts elicitation supportOther
:cli-pathor:cli-urlsession.custom_agents_updatedevent type addedFiles Changed (11 files, +668/-24)
specs.clj— command, capabilities, elicitation specssession.clj— command handling, elicitation convenience APIclient.clj— wire format, capabilities, event routing, CLI path env varcopilot_sdk.clj— public API delegates, event type setsinstrument.clj— fdefs for 6 new functionsintegration_test.clj— 8 new testsmock_server.clj— handlePendingCommand support, hook response mergingAPI.md— Commands section, UI Elicitation section, updated tablesCHANGELOG.md— v0.2.1 sync entriesbuild.clj/README.md— version bumpTesting