pub struct LocalServerBuilder { /* private fields */ }Expand description
Builder for the local deployment flavor: a fully in-memory, auth-off, single-process server, embeddable in-process.
All knobs are optional — LocalServer::builder().spawn().await boots the
default flavor (in-memory everything, loopback :8787, no auth, no seed).
Construct with LocalServer::builder.
Implementations§
Source§impl LocalServerBuilder
impl LocalServerBuilder
Sourcepub fn addr(self, addr: SocketAddr) -> Self
pub fn addr(self, addr: SocketAddr) -> Self
Bind on the given address instead of the default 127.0.0.1:8787.
Use port 0 for an ephemeral port (read the real one back from
LocalServer::addr after spawn).
Sourcepub fn seed_kb(self, seed: bool) -> Self
pub fn seed_kb(self, seed: bool) -> Self
Seed the knowledge base with the demo docs on boot (default false).
Handy for an embedded demo / smoke test with grounded answers.
Sourcepub fn auth(self, auth: Arc<dyn AuthVerifier>) -> Self
pub fn auth(self, auth: Arc<dyn AuthVerifier>) -> Self
Install a custom AuthVerifier for the local flavor.
Without this, the local flavor runs auth-off (NoAuthVerifier) — fine
for pure loopback. Pass a
LocalTokenVerifier to gate
stray local processes with a shared secret (recommended when binding
beyond loopback, e.g. over a tailnet).
Sourcepub fn tools(self, provider: Arc<dyn ToolProvider>) -> Self
pub fn tools(self, provider: Arc<dyn ToolProvider>) -> Self
Install a host ToolProvider so the runner merges its per-turn tools
into every turn alongside the built-ins (the #68 injection seam). The
local flavor uses this to add an OS-sandboxed shell + egress-routed tools
— the isolation the cloud flavor gets from its container/network sandbox
instead.
Sourcepub fn serve_widget(self, token: Option<String>) -> Self
pub fn serve_widget(self, token: Option<String>) -> Self
Serve the official @smooai/smooth-operator widget from this server: a
host page at / and the bundle at /chat-widget.iife.js. token is
injected into the page so the widget connects to this server’s
/ws?token=… (pair it with a matching auth verifier);
pass None for a no-auth local server.
Sourcepub fn config(self, config: ServerConfig) -> Self
pub fn config(self, config: ServerConfig) -> Self
Override the full ServerConfig (e.g. to point at a gateway / model).
The local flavor still forces in-memory storage and the caller’s bind addr regardless of what this config says — the storage/bind fields are overwritten — so the “no external services” guarantee always holds. Use this to set the gateway URL / key / model / limits for live turns.
Sourcepub async fn spawn(self) -> Result<LocalServer>
pub async fn spawn(self) -> Result<LocalServer>
Bind and spawn the server in a background task, returning a LocalServer
handle carrying the real bound address (resolved even for port 0)
and a graceful-shutdown switch.
§Errors
Returns an error if binding the TCP listener fails (e.g. the port is in use). Serving errors after a successful bind surface when the handle is awaited / shut down.
Trait Implementations§
Source§impl Clone for LocalServerBuilder
impl Clone for LocalServerBuilder
Source§fn clone(&self) -> LocalServerBuilder
fn clone(&self) -> LocalServerBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalServerBuilder
impl Debug for LocalServerBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for LocalServerBuilder
impl !UnwindSafe for LocalServerBuilder
impl Freeze for LocalServerBuilder
impl Send for LocalServerBuilder
impl Sync for LocalServerBuilder
impl Unpin for LocalServerBuilder
impl UnsafeUnpin for LocalServerBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request