Rust SDK: add typed SessionCapability enum and ClientOptions builders#1455
Draft
Morabbin wants to merge 1 commit into
Draft
Rust SDK: add typed SessionCapability enum and ClientOptions builders#1455Morabbin wants to merge 1 commit into
Morabbin wants to merge 1 commit into
Conversation
Adds a typed `SessionCapability` enum and matching `ClientOptions` fields plus builder methods to the Rust SDK, so callers can express "enable memory", "disable bash", etc. without stringly-typed flags. - `SessionCapability` is `#[non_exhaustive]`, kebab-case-serialized, and has an `Other(String)` escape hatch for forward compatibility with capabilities the runtime adds. - `ClientOptions` gains `enabled_capabilities` and `disabled_capabilities` vectors and four builders: `with_enable_capability`, `with_disable_capability`, `with_enabled_capabilities`, `with_disabled_capabilities`. - `Client::capability_args` emits the corresponding CLI flags (enables first, then disables, in insertion order), threaded into both `spawn_stdio` and `spawn_tcp` between `remote_args` and `extra_args`. Disable wins on conflict. Pairs with github/copilot-agent-runtime#8029 (CLI flags) and github/agents#981 (Desktop missing memory capability). 11 new unit tests cover the enum's `Display`, `FromStr`, `From<&str>`, `From<String>`, serde round-trip, and the capability-args ordering / disable-wins semantics. Co-authored-by: Copilot <[email protected]>
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.
Why
Fixes the Desktop app missing memory capability issue (github/agents#981).
The Desktop SDK currently accepts only stringly-typed capability flags, making it error-prone and giving callers no discoverability. This PR introduces a typed
SessionCapabilityenum so callers can writewith_enable_capability(SessionCapability::Memory)instead of hand-rolling--enable-capability memorystrings.Pairs with the CLI flag plumbing in github/copilot-agent-runtime#8029.
What
SessionCapabilityenum -- typed variants for all 10 current CLI capability names plusOther(String)for forward compatibility.ClientOptionsgainsenabled_capabilities/disabled_capabilitiesvectors and four chainable builders:with_enable_capability,with_disable_capability,with_enabled_capabilities,with_disabled_capabilities.Client::capability_argsemits--enable-capability <name>/--disable-capability <name>flags (enables first, then disables, in insertion order) and is hooked into bothspawn_stdioandspawn_tcpbetweenremote_argsandextra_args.README.mdupdated: new rows in theClientOptionstable, a new### Session capabilitiessubsection, and a bullet in the Rust-only API section.Display,FromStr,From<&str>,From<String>, serde round-trip, arg ordering, and disable-wins semantics.Pre-existing test breakage (unrelated to this PR)
rust/tests/session_test.rsandrust/tests/protocol_version_test.rsare broken onmaindue to removed API methods (from_streams_with_trace_provider,from_streams_with_connection_token, etc.). These are pre-existing failures not caused by this change. Lib + doc tests and clippy (--lib) are all green.Checklist
cargo fmt --checkpassescargo clippy --lib -- -D warningspassescargo test --libpasses (137 tests)cargo test --docpasses (19 tests)cargo buildpasses