You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`program`|`CliProgram`|`Resolve` (default: auto-detect) or `Path(PathBuf)` (explicit)|
78
+
|`prefix_args`|`Vec<OsString>`| Args before `--server` (e.g. script path for node)|
79
+
|`working_directory`|`PathBuf`| Working directory for CLI process (empty = host process's cwd)|
80
+
|`env`|`Vec<(OsString, OsString)>`| Environment variables for CLI process|
81
+
|`env_remove`|`Vec<OsString>`| Environment variables to remove|
82
+
|`extra_args`|`Vec<String>`| Extra CLI flags|
83
+
|`transport`|`Transport`|`Default`, `Stdio`, `InProcess`, `Tcp`, or `External`|
84
84
85
85
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`.
86
86
@@ -749,7 +749,7 @@ none of them are scheduled for removal.
749
749
caller-supplied `AsyncRead` / `AsyncWrite`. Useful for testing,
750
750
in-process embedding, or custom transports. Other SDKs are spawn-only
751
751
or fixed-stdio.
752
-
-**`enum Transport { Stdio, Tcp, External }`** — explicit, exhaustive
transport selector on `ClientOptions::transport`. Node/Python/Go rely
754
754
on conditional config field combinations instead.
755
755
-**Split `prefix_args` / `extra_args`** on `ClientOptions` — separate
@@ -776,7 +776,14 @@ none of them are scheduled for removal.
776
776
777
777
## Embedded CLI
778
778
779
-
The SDK provisions the Copilot CLI binary at build time. By default the `bundled-cli` feature embeds the verified binary directly in your compiled crate, so end-user binaries are self-contained — no env var setup, no separate install, just `cargo build`.
779
+
The SDK provisions the Copilot CLI binary at build time. By default the
780
+
`bundled-cli` feature embeds only the verified CLI executable in your compiled
781
+
crate. Enable `bundled-in-process` to additionally embed the native
782
+
runtime library and use `Transport::InProcess`:
783
+
784
+
```toml
785
+
github-copilot-sdk = { version = "0.1", features = ["bundled-in-process"] }
786
+
```
780
787
781
788
For builds that prefer a smaller artifact, disable the `bundled-cli` feature:
The resolved version is baked into the crate via `cargo:rustc-env=COPILOT_SDK_CLI_VERSION` regardless of mode. The runtime resolver consumes it to recompute the on-disk path by convention, so no absolute paths leak into the rlib.
814
821
815
-
2.**Build time:**`build.rs` downloads the platform-appropriate archive from the [`github/copilot-cli` GitHub Releases](https://github.com/github/copilot-cli/releases) (`copilot-{platform}.tar.gz` on macOS/Linux, `.zip` on Windows), live-fetches the matching `SHA256SUMS.txt`, and verifies the archive hash. Then:
816
-
-**`bundled-cli` on (default, release):** embeds the raw archive bytes via `include_bytes!()`. Runtime extracts on first `Client::start()`.
822
+
2.**Build time:**`build.rs` downloads the platform-specific npm package and
823
+
verifies its `sha512` integrity against the lockfile or publish snapshot.
824
+
Then:
825
+
-**`bundled-cli` on (default):** creates and embeds a minimal archive containing only the CLI executable.
826
+
-**`bundled-in-process` on:** the minimal archive additionally contains the platform-native runtime library (`.dll`, `.so`, or `.dylib`); no other npm package files are embedded.
817
827
-**`bundled-cli` off:** extracts the binary directly into the platform cache (staging file + atomic rename), idempotent across rebuilds. If the extracted binary is already present at the expected path, the download is skipped entirely — the extracted binary *is* the cache.
|`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`). |
905
-
|`derive`| — |`schema_for::<T>()` for generating JSON Schema from Rust types (adds `schemars`). Enable when defining [tool parameters](#tool-registration). |
912
+
| Feature | Default | Description |
913
+
| ------- | ------- | ----------- |
914
+
|`bundled-cli`| ✓ | Embeds only the CLI executable. Disable via `default-features = false` when supplying the CLI via `CliProgram::Path` or `COPILOT_CLI_PATH`. |
915
+
|`bundled-in-process`| — | Enables `Transport::InProcess`, implies `bundled-cli`, and additionally embeds only the platform-native runtime library. |
916
+
|`derive`| — |`schema_for::<T>()` for generating JSON Schema from Rust types (adds `schemars`). |
906
917
907
918
```toml
908
919
# These examples use registry syntax for illustration; until the crate is
0 commit comments