pub struct ServeConfig { /* private fields */ }Expand description
How a served connection is configured.
The client supplies the workspace per session (cwd on session/new), so
what belongs here is only what the client cannot say: which model and
endpoint to use, whether commands are granted, and which permission mode
each session opens in.
One of these describes a server, not a connection: it is cloned into every handler and, on the bridge, into every connection served, so the runtime and workspaces its source holds are the process’s (ADR-0018). Building a second one builds a second runtime.
Implementations§
Source§impl ServeConfig
impl ServeConfig
Sourcepub fn new(template: impl Into<Option<RunConfig>>) -> Self
pub fn new(template: impl Into<Option<RunConfig>>) -> Self
Serves sessions built from template, whose workspace each session
replaces with the cwd its client sent.
The template’s process half — provider, endpoint, model — becomes the
recipe for the one Runtime every session runs on
(ADR-0018), built on the first session/new rather than here, so that a
missing credential still reaches the client as auth_required rather
than stopping the server from starting.
Sessions open at ApprovalMode::Prompt rather than at basis’s library
default of allowing everything: over ACP there is a client to ask, which
is the whole reason the protocol carries a permission request. An
operator who wants otherwise says so with
with_initial_mode — the template cannot
carry it, because a RunConfig no longer has an opinion about
approval to carry (ADR-0010).
Sourcepub fn with_source(source: impl SessionSource) -> Self
pub fn with_source(source: impl SessionSource) -> Self
Serves sessions the caller supplies.
Sourcepub fn with_initial_mode(self, mode: ApprovalMode) -> Self
pub fn with_initial_mode(self, mode: ApprovalMode) -> Self
Opens each session in mode instead of asking every time.
Trait Implementations§
Source§impl Clone for ServeConfig
impl Clone for ServeConfig
Source§fn clone(&self) -> ServeConfig
fn clone(&self) -> ServeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more