Skip to main content

HarnessConfig

Struct HarnessConfig 

Source
pub struct HarnessConfig {
Show 53 fields pub config_version: u32, pub listen: String, pub upstream_url: String, pub tool_upstream_url: Option<String>, pub upstream_http2_prior_knowledge: bool, pub upstream_read_timeout_s: Option<u64>, pub upstream_chat_path: String, pub upstream_api_key_env: Option<String>, pub upstream_api_key_file: Option<String>, pub upstream_auth_header: String, pub upstream_auth_scheme: String, pub upstream_authorization_passthrough: bool, pub tool_upstream_bearer_env: Option<String>, pub tool_upstream_bearer_file: Option<String>, pub require_identity: bool, pub audience: String, pub identity_jwks_url: Option<String>, pub identity_jwks_refresh_s: u64, pub identity_allowed_issuers: Vec<String>, pub identity_hmac_secret_file: Option<String>, pub identity_hmac_kid: String, pub enforce_identity_scopes: bool, pub chat_scope: String, pub session_close_scope: String, pub session_promote_scope: String, pub default_workflow: String, pub consequential_tools: Vec<String>, pub tool_schema_dir: Option<String>, pub require_tool_schema: bool, pub wasm_policy_paths: Vec<String>, pub session_idle_close_s: u64, pub atif_spool_dir: String, pub bridge_data_dir: String, pub bridge_backend: String, pub bridge_manifest_path: String, pub bridge_endpoint: Option<String>, pub state_backend: String, pub state_endpoint: Option<String>, pub embedder_backend: String, pub onnx_model_path: Option<String>, pub onnx_tokenizer_path: Option<String>, pub onnx_dimension: usize, pub vector_backend: String, pub qdrant_url: Option<String>, pub qdrant_collection: String, pub worker_channel_capacity: usize, pub strict_stage_budget: bool, pub breaker: BreakerConfig, pub compression_enabled: bool, pub budget: BudgetSpec, pub reconcile_tick_s: u64, pub max_request_bytes: usize, pub dashboard_enabled: bool,
}
Expand description

Top-level harness configuration.

Unknown keys are rejected (deny_unknown_fields) so a typo like idel_timeout_s fails loudly at startup instead of being silently ignored. Forward compatibility is handled by config_version gating, not by tolerating unrecognized keys.

Fields§

§config_version: u32

Config format version.

§listen: String

Listen address, e.g. 127.0.0.1:8484.

§upstream_url: String

Upstream LLM provider base URL (OpenAI-compatible).

§tool_upstream_url: Option<String>

Optional downstream MCP/REST tool server URL. When absent, /v1/mcp operates as a policy decision endpoint.

§upstream_http2_prior_knowledge: bool

Use cleartext HTTP/2 prior knowledge for trusted h2c upstreams.

§upstream_read_timeout_s: Option<u64>

Optional provider read-idle timeout. None permits intentionally held streams.

§upstream_chat_path: String

Chat-completions path appended to upstream_url. Override for providers with non-standard layouts (Azure deployments, Gemini’s OpenAI-compatible surface).

§upstream_api_key_env: Option<String>

Name of an environment variable holding the upstream API key. The key value itself never appears in this file or on the command line.

§upstream_api_key_file: Option<String>

File containing the upstream API key (owner-only permissions are enforced on Unix). Mutually exclusive with upstream_api_key_env.

§upstream_auth_header: String

Header carrying the upstream API key, e.g. authorization (OpenAI), api-key (Azure), or x-api-key.

§upstream_auth_scheme: String

Prefix inserted before the key in the auth header. "Bearer" yields Bearer <key>; an empty string sends the raw key (Azure style).

§upstream_authorization_passthrough: bool

Forward each client’s own Authorization header to the upstream instead of injecting a server-side key. Incompatible with require_identity (the header would carry the NHI token) and with the static key options above.

§tool_upstream_bearer_env: Option<String>

Name of an environment variable holding a bearer token for tool_upstream_url requests.

§tool_upstream_bearer_file: Option<String>

File containing a bearer token for tool_upstream_url requests (owner-only permissions enforced on Unix).

§require_identity: bool

Identity enforcement. When false (dev), requests without a token get an anonymous identity; when true, unauthenticated requests are 401s.

§audience: String

Deployment audience for NHI tokens.

§identity_jwks_url: Option<String>

Corporate IdP JWKS endpoint for Ed25519 verification keys.

§identity_jwks_refresh_s: u64

JWKS refresh interval in seconds.

§identity_allowed_issuers: Vec<String>

Optional issuer allowlist (for example Okta or Entra tenant URLs).

§identity_hmac_secret_file: Option<String>

Optional file containing an HS256 development secret.

§identity_hmac_kid: String

Key id assigned to the development HMAC secret.

§enforce_identity_scopes: bool

Enforce operation scopes on validated identities.

Round-30 F1: default flipped from true to false so it matches the also-default-false posture of Self::require_identity. When require_identity = false, unauthenticated requests short-circuit to the anonymous identity BEFORE the scope gate runs — an operator who reads enforce_identity_scopes = true in the config would reasonably conclude “you need the scope to reach /v1/chat”, but in the default posture curl-with-no-header still proceeds as anonymous. validate() now rejects the enforce_identity_scopes = true && require_identity = false combination outright; keeping the two defaults aligned makes the shipped harness.example.toml and harness.container.toml pass validate without extra changes. Operators turning on identity enforcement in production set both flags to true explicitly (see harness.docker.toml).

§chat_scope: String

Scope required for chat completion requests.

§session_close_scope: String

Scope required to close sessions.

§session_promote_scope: String

Scope required to promote unsigned sessions.

§default_workflow: String

Default workflow when X-AV-Workflow is absent: signed workflows are opt-in by policy (brief Module G).

§consequential_tools: Vec<String>

Tools that require a signed workflow because they have real-world consequences.

§tool_schema_dir: Option<String>

Directory containing one JSON Schema per tool, named <tool>.json.

§require_tool_schema: bool

Reject tool calls when no matching schema was loaded.

§wasm_policy_paths: Vec<String>

WASM or WAT policy module paths, evaluated in order.

§session_idle_close_s: u64

Idle seconds after which a session is swept closed.

§atif_spool_dir: String

Directory for ATIF trajectory spool files.

§bridge_data_dir: String

Bridge data directory (embedded broker).

§bridge_backend: String

Bridge backend: embedded, kafka, or nats.

§bridge_manifest_path: String

Declarative topic-schema manifest used by every Bridge backend.

§bridge_endpoint: Option<String>

Kafka broker (host:port[,host:port]) or NATS URL (nats:///tls://) for network Bridge backends. Secured endpoints read their material from the environment: AV_KAFKA_CA_FILE + AV_KAFKA_SASL_USERNAME/ AV_KAFKA_SASL_PASSWORD (+ optional AV_KAFKA_SASL_MECHANISM: SCRAM-SHA-256 default, SCRAM-SHA-512, or PLAIN; credentials are refused without the CA), and AV_NATS_CA_FILE (forces TLS) + AV_NATS_USER/AV_NATS_PASSWORD.

§state_backend: String

State backend: memory or redis.

§state_endpoint: Option<String>

Redis URL for the distributed state backend. A comma-separated list of URLs selects Redis Cluster mode.

§embedder_backend: String

Embedding backend: hash or onnx.

§onnx_model_path: Option<String>

Customer-supplied ONNX model path.

§onnx_tokenizer_path: Option<String>

Hugging Face tokenizer.json paired with the ONNX model.

§onnx_dimension: usize

ONNX model output width.

§vector_backend: String

Vector persistence backend: memory or qdrant.

§qdrant_url: Option<String>

Qdrant base URL.

§qdrant_collection: String

Qdrant collection receiving reasoning vectors.

§worker_channel_capacity: usize

Worker channel capacity (bounded; overflow is counted, never blocking).

§strict_stage_budget: bool

Strict per-stage budget assertions (AV_STRICT_BUDGET also enables).

§breaker: BreakerConfig

Loop breaker configuration.

§compression_enabled: bool

Compression configuration.

§budget: BudgetSpec

Token budget per session (compression/velocity accounting).

§reconcile_tick_s: u64

Reconciler tick interval (seconds).

§max_request_bytes: usize

Maximum request body size accepted on /v1/chat/completions and /mcp. Defaults to 4 MiB, matching the sandbox’s MAX_PAYLOAD_BYTES so both routes carry the same effective limit — axum’s own DefaultBodyLimit::MAX is 2 MiB by default and would silently reject legitimate large-context chat requests before the sandbox even saw the payload. Operators serving very-long-context models (Claude 200k, GPT-4 128k on maximally-verbose inputs) may need to raise this.

§dashboard_enabled: bool

Whether the built-in read-only operator dashboard is enabled.

When true (the default), the harness serves:

  • GET /dashboard — an HTML/CSS/JS single-page dashboard,
  • GET /dashboard/{style.css,app.js} — the bundled assets,
  • GET /api/v1/dashboard/{stats,sessions,sessions/:id} — read-only JSON that mirrors the in-memory session registry.

The endpoints are unauthenticated: they expose the same data that already lands on disk (receipts) and in /metrics. Front the harness with the same ingress control you use for /metrics if this is a concern, or set this to false to disable them.

Implementations§

Source§

impl HarnessConfig

Source

pub fn from_toml(s: &str) -> Result<Self, String>

Parse from TOML, validating the version and structural sanity.

Source

pub fn from_toml_unvalidated(s: &str) -> Result<Self, String>

Parse from TOML without validating, so environment overrides can be applied first (main validates after Self::apply_env_overrides).

Source

pub fn builtin() -> Result<Self, String>

A config of pure built-in defaults for zero-config startup. The caller must supply upstream_url (typically AV_UPSTREAM_URL) before validation.

Source

pub fn uses_default_manifest_path(&self) -> bool

True when bridge_manifest_path is the compiled-in default, i.e. the operator never chose a manifest. Only then may the binary fall back to its embedded manifest when the file is absent; an explicit path that is missing must stay a hard error.

Source

pub fn uses_default_tool_schema_dir(&self) -> bool

True when tool_schema_dir is the compiled-in default (see Self::uses_default_manifest_path for the fallback rationale).

Source

pub fn is_default_policy_path(path: &str) -> bool

True when path is the compiled-in default WASM policy entry (see Self::uses_default_manifest_path for the fallback rationale).

Source

pub fn duplicated_chat_path_segment(&self) -> Option<&str>

Detect the classic footgun of upstream_url already ending with the first segment of upstream_chat_path (for example a base URL of https://api.openai.com/v1 joined with /v1/chat/completions produces /v1/v1/... and a confusing provider 404). Returns the duplicated segment for warning messages.

Source

pub fn apply_env_overrides(&mut self)

Apply AV_* environment overrides from the process environment. Environment beats file for these scalars (12-factor container deployments override without editing mounted files). Key values are still never read here — only AV_UPSTREAM_API_KEY presence selects itself as the key source.

Source

pub fn apply_env_overrides_from(&mut self, get: impl Fn(&str) -> Option<String>)

Testable core of Self::apply_env_overrides.

Source

pub fn validate(&self) -> Result<(), String>

Structural validation.

Trait Implementations§

Source§

impl Clone for HarnessConfig

Source§

fn clone(&self) -> HarnessConfig

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 HarnessConfig

Source§

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

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

impl<'de> Deserialize<'de> for HarnessConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HarnessConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.

§

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

§

fn from_ref(input: &T) -> T

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

impl<T> Instrument for T

§

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

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

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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

§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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