Skip to main content

ServerConfig

Struct ServerConfig 

Source
pub struct ServerConfig {
Show 20 fields pub state_dir: PathBuf, pub listen: SocketAddr, pub octoprint: OctoPrintConfig, pub safety: SafetyEnvelope, pub harness: HarnessIdentity, pub model: Option<ModelName>, pub skill_path: PathBuf, pub prompt_template_path: Option<PathBuf>, pub observation_interval: Duration, pub printer_poll: Duration, pub unattended_window: Duration, pub blank_frame_max_stddev: BlankFrameBound, pub obico_ml_api_url: Option<WebAddress>, pub ingress_answer_bound: Duration, pub ingress_shared_secret: SharedSecret, pub api_credential: Option<ApiCredential>, pub api_credential_verifier: Option<CredentialVerifier>, pub camera_snapshot_url: Option<WebAddress>, pub obico_api: Option<ObicoApi>, pub spools: SpoolPolicy,
}
Expand description

One running server’s validated configuration.

Every value here is one no later step has to re-examine, and where a validated type for one already exists it is that type rather than the text it was written as: the OctoPrint instance is the adapter’s own configuration, which redacts the key it carries; the harness and the model are the supervisor adapter’s own names; and the ingress secret is a value neither rendering of which shows.

Fields§

§state_dir: PathBuf

Where the store, the images and the sessions live.

§listen: SocketAddr

The address the API and the ingress are served on.

§octoprint: OctoPrintConfig

Everything the printer adapter needs to reach the instance.

§safety: SafetyEnvelope

The operator’s safety envelope.

§harness: HarnessIdentity

The harness identity turns run on.

§model: Option<ModelName>

The model turns are pinned to, when one is pinned.

§skill_path: PathBuf

The installed skill’s SKILL.md, whose prose is sent as every turn’s system prompt. The agent runs from the directory holding it, which is where the skill’s own reference/ documents sit.

§prompt_template_path: Option<PathBuf>

The prompt template one turn fills, when the operator supplied one.

§observation_interval: Duration

How often every active print is given a periodic observation.

§printer_poll: Duration

How often the printer watch reads the machine.

§unattended_window: Duration

How long after an unfinished ending the printer acting on its own is recorded.

§blank_frame_max_stddev: BlankFrameBound

The grey-level spread at or below which a camera frame is blank.

§obico_ml_api_url: Option<WebAddress>

Where the failure detector’s own service answers its health check, when configured.

§ingress_answer_bound: Duration

How long the ingress may take to answer.

§ingress_shared_secret: SharedSecret

The shared secret every post to the ingress must carry.

§api_credential: Option<ApiCredential>

A plaintext operator credential the configuration still carries, which is admitted — with a warning on every start — until it is replaced by its verifier.

§api_credential_verifier: Option<CredentialVerifier>

The verifier the operator’s credential is checked against, when the configuration names one. Absent, the composition root reads the one in the state directory.

§camera_snapshot_url: Option<WebAddress>

Where a fresh frame of the print is fetched from, when configured.

§obico_api: Option<ObicoApi>

Obico’s own API, when configured; its debug form omits the token.

§spools: SpoolPolicy

How spools are checked before a print, and the margin asked for.

Implementations§

Source§

impl ServerConfig

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self, ConfigError>

Read and validate the one configuration file this program takes.

§Errors

Returns ConfigError::Unreadable when the file is not there, ConfigError::Unparsable when it is not this program’s configuration, and ConfigError::Field naming the one field whose value cannot be accepted. The two values only the machine can rule on — the OctoPrint address and key — are ruled on by crate::Server::start, which is where a printer exists to ask.

Source

pub fn parse(text: &str, path: &Path) -> Result<Self, ConfigError>

The same, over a document already read.

§Errors

The same as ServerConfig::load, less the unreadable file.

Source

pub fn assets_dir(&self) -> PathBuf

Where this server materializes the agent’s prompt template and assessment schema. The skill is not among them: it is the installed one skill_path names.

Trait Implementations§

Source§

impl Clone for ServerConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ServerConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ServerConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more