pub struct ClientBuilder { /* private fields */ }Expand description
Builder for creating a Copilot client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn cli_args<I, S>(self, args: I) -> Self
pub fn cli_args<I, S>(self, args: I) -> Self
Set additional CLI arguments passed to the Copilot CLI.
Sourcepub fn cli_arg(self, arg: impl Into<String>) -> Self
pub fn cli_arg(self, arg: impl Into<String>) -> Self
Add a single CLI argument passed to the Copilot CLI.
Sourcepub fn cli_url(self, url: impl Into<String>) -> Self
pub fn cli_url(self, url: impl Into<String>) -> Self
Set the CLI URL for TCP mode.
Supports: "host:port", "http://host:port", or "port" (defaults to localhost).
Sourcepub fn port(self, port: u16) -> Self
pub fn port(self, port: u16) -> Self
Set port for TCP mode (ignored for stdio mode).
Use 0 to let the CLI choose a random available port.
Sourcepub fn auto_start(self, auto_start: bool) -> Self
pub fn auto_start(self, auto_start: bool) -> Self
Auto-start the connection on first use.
Sourcepub fn auto_restart(self, auto_restart: bool) -> Self
pub fn auto_restart(self, auto_restart: bool) -> Self
Auto-restart the connection after a fatal failure.
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an environment variable.
Sourcepub fn github_token(self, token: impl Into<String>) -> Self
pub fn github_token(self, token: impl Into<String>) -> Self
Set a GitHub personal access token for authentication.
Sourcepub fn use_logged_in_user(self, value: bool) -> Self
pub fn use_logged_in_user(self, value: bool) -> Self
Set whether to use the logged-in user for auth.
Sourcepub fn deny_tool(self, tool_spec: impl Into<String>) -> Self
pub fn deny_tool(self, tool_spec: impl Into<String>) -> Self
Add a single tool specification to deny.
Passed as --deny-tool to the CLI. Takes precedence over allow options.
§Example
use copilot_sdk::Client;
let client = Client::builder()
.deny_tool("shell(git push)")
.deny_tool("shell(git commit)")
.deny_tool("shell(rm)")
.build()?;Sourcepub fn deny_tools<I, S>(self, tool_specs: I) -> Self
pub fn deny_tools<I, S>(self, tool_specs: I) -> Self
Set multiple tool specifications to deny.
Passed as --deny-tool arguments to the CLI.
Sourcepub fn allow_tool(self, tool_spec: impl Into<String>) -> Self
pub fn allow_tool(self, tool_spec: impl Into<String>) -> Self
Add a single tool specification to allow without manual approval.
Passed as --allow-tool to the CLI.
Sourcepub fn allow_tools<I, S>(self, tool_specs: I) -> Self
pub fn allow_tools<I, S>(self, tool_specs: I) -> Self
Set multiple tool specifications to allow without manual approval.
Passed as --allow-tool arguments to the CLI.
Sourcepub fn allow_all_tools(self, allow: bool) -> Self
pub fn allow_all_tools(self, allow: bool) -> Self
Allow all tools without manual approval.
Passes --allow-all-tools to the CLI. Use with deny_tool() to create
an allowlist with specific exceptions.
§Example
use copilot_sdk::Client;
// Allow everything except dangerous git operations and rm
let client = Client::builder()
.allow_all_tools(true)
.deny_tool("shell(git push)")
.deny_tool("shell(git commit)")
.deny_tool("shell(rm)")
.build()?;Trait Implementations§
Source§impl Debug for ClientBuilder
impl Debug for ClientBuilder
Source§impl Default for ClientBuilder
impl Default for ClientBuilder
Source§fn default() -> ClientBuilder
fn default() -> ClientBuilder
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
impl UnwindSafe for ClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more