Skip to content
Open
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
183 changes: 178 additions & 5 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,24 @@ include = [
name = "github_copilot_sdk"

[features]
default = ["bundled-cli"]
default = ["bundled-cli", "rustls-tls"]
bundled-cli = ["dep:tar", "dep:flate2", "dep:zip"]
derive = ["dep:schemars"]
test-support = []

# TLS backend for the request-handler HTTP/WebSocket transport; enable at least
# one. `rustls-tls` (default) uses rustls + `ring`, keeping the SDK OpenSSL-free

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runtime is using aws-lc-rs. Once they're in the same process, we'll have two crypto stacks. Can we standardize on one?

# for musl/static builds. `native-tls` links the platform stack. Features are
# additive: with both enabled the transport prefers native-tls.
rustls-tls = [
"reqwest/rustls-tls-native-roots",
"tokio-tungstenite/rustls-tls-native-roots",
]
native-tls = [
"reqwest/native-tls",
"tokio-tungstenite/native-tls",
]

# Build docs.rs documentation with all features so feature-gated APIs
# (e.g. `define_tool`, `schema_for`) appear and intra-doc links resolve.
# Mirror this locally with: `cargo doc --no-deps --all-features`.
Expand Down Expand Up @@ -58,8 +71,8 @@ base64 = "0.22"
bytes = "1"
http = "1"
futures-util = "0.3"
reqwest = { version = "0.12", default-features = false, features = ["stream", "http2", "default-tls"] }
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "native-tls"] }
reqwest = { version = "0.12", default-features = false, features = ["stream", "http2"] }
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect"] }

[target.'cfg(windows)'.dependencies]
zip = { version = "2", default-features = false, features = ["deflate"], optional = true }
Expand Down
13 changes: 10 additions & 3 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -902,17 +902,24 @@ Supported: `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `win32-x64`
| Feature | Default | Description |
| -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bundled-cli` | ✓ | Build-time CLI embedding. Pulls in `tar`+`flate2` (Linux/macOS) or `zip` (Windows). Disable via `default-features = false` to opt out (e.g. when shipping a smaller binary or when always supplying the CLI via `CliProgram::Path` / `COPILOT_CLI_PATH`). |
| `rustls-tls` | ✓ | TLS backend for the `CopilotRequestHandler` HTTP/WebSocket transport: rustls + `ring` with the OS trust store. OpenSSL-free, so `*-unknown-linux-musl` and other static targets cross-compile without a system OpenSSL sysroot. |
| `native-tls` | — | Alternative TLS backend linking the platform-native stack (OpenSSL on Linux, Secure Transport on macOS, SChannel on Windows). Use with `default-features = false` when you want the system TLS stack instead of rustls. |
| `derive` | — | `schema_for::<T>()` for generating JSON Schema from Rust types (adds `schemars`). Enable when defining [tool parameters](#tool-registration). |

> **Note:** `default-features = false` drops `rustls-tls` (and `bundled-cli`). Re-add a TLS backend — `rustls-tls` or `native-tls` — so the transport can reach HTTPS upstreams.

```toml
# These examples use registry syntax for illustration; until the crate is
# published, use a path or git dependency instead.

# Default — bundles the Copilot CLI in your binary.
# Default — bundles the Copilot CLI and uses the rustls TLS backend.
github-copilot-sdk = "0.1"

# Opt out of bundling — resolve CLI from COPILOT_CLI_PATH or system PATH instead.
github-copilot-sdk = { version = "0.1", default-features = false }
# Opt out of bundling; re-add a TLS backend since defaults are off.
github-copilot-sdk = { version = "0.1", default-features = false, features = ["rustls-tls"] }

# Use the platform-native TLS stack instead of rustls.
github-copilot-sdk = { version = "0.1", default-features = false, features = ["bundled-cli", "native-tls"] }

# Derive JSON Schema for tool parameters (adds to default bundled-cli).
github-copilot-sdk = { version = "0.1", features = ["derive"] }
Expand Down
Loading