Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,53 @@ client.stop().await?;

With the default `CliProgram::Resolve`, `Client::start()` resolves the CLI in this order: an explicit `CliProgram::Path(path)`, the `COPILOT_CLI_PATH` env var, then the bundled CLI that was embedded at build time. There is no PATH scanning — if you've opted out of bundling (`default-features = false`) you must supply either `CliProgram::Path` or `COPILOT_CLI_PATH`.

### Session capabilities

The `SessionCapability` enum lets callers enable or disable named runtime features on a **per-session** basis. Capabilities are sent to the runtime as part of the `session.create` / `session.resume` JSON-RPC calls via two wire fields:

- `enabledCapabilities` -- capabilities to opt the session into (extends the `SDK_CAPABILITIES` baseline)
- `disabledCapabilities` -- capabilities to opt the session out of (disable wins on overlap)

> **Experimental.** Per-session capability controls are an experimental
> wire-protocol surface and may change or be removed in future SDK or CLI
> releases.

> **Runtime dependency.** Per-session capability controls require a runtime
> version that supports `enabledCapabilities` and `disabledCapabilities`.
> On older runtimes the fields are silently ignored.

Use `SessionConfig::with_enable_capability` / `with_disable_capability` (and their plural counterparts):

```rust,ignore
use github_copilot_sdk::{SessionCapability, SessionConfig};

let session = client.create_session(
SessionConfig::default()
.with_enable_capability(SessionCapability::Memory),
).await?;
```

On resume, use the same builders on `ResumeSessionConfig`:

```rust,ignore
use github_copilot_sdk::{ResumeSessionConfig, SessionCapability};

let session = client.resume_session(
ResumeSessionConfig::new(session_id)
.with_enable_capability(SessionCapability::Memory),
).await?;
```

**Variants.** See the `SessionCapability` enum's own documentation for the
authoritative set of capabilities and their wire names.

**Disable-wins semantics.** If the same capability appears in both
`enabled_capabilities` and `disabled_capabilities`, disable wins. The runtime
starts from an `SDK_CAPABILITIES` baseline; enabled capabilities extend it and
disabled capabilities remove from it, in that order. `SessionCapability::Unknown`
exists only as a generated deserialization fallback and is rejected if supplied
to the create/resume capability builders.

### Session

Created via `Client::create_session` or `Client::resume_session`. Owns an internal event loop that dispatches CLI callbacks to the focused handler traits you install on `SessionConfig`, and broadcasts session events through `subscribe()`.
Expand Down Expand Up @@ -714,6 +761,11 @@ gets to be Rust here — cross-SDK parity for these is a post-release
conversation, not a release blocker. None of these are deprecated and
none of them are scheduled for removal.

- **`SessionCapability` enum** -- typed enum for per-session
capability opt-in / opt-out. Sent via `enabledCapabilities` /
Comment thread
Morabbin marked this conversation as resolved.
`disabledCapabilities` on the `session.create` and `session.resume` wire
calls. See [Session capabilities](#session-capabilities) above.
Experimental.
- **Typed newtypes** — `SessionId` and `RequestId` are `#[serde(transparent)]`
newtypes around `String`, so the type system distinguishes a session
identifier from an arbitrary `String` at compile time. Node/Python/Go
Expand Down
Loading
Loading