Skip to main content

StandardWebDecisionRuntime

Struct StandardWebDecisionRuntime 

Source
pub struct StandardWebDecisionRuntime { /* private fields */ }
Expand description

Single-use target runtime for evidence collection and deterministic decisions.

§Examples

use url::Url;
use termivar_scanner::StandardWebDecisionRuntime;

let target = Url::parse("https://example.test/")?;
let mut runtime = StandardWebDecisionRuntime::builder(target)
    .planning_budget(100)
    .risk_limit(40)
    .max_action_cycles(8)
    .enable_api_reasoning()
    .build()?;

let report = runtime.analyze().await?;
println!("terminal command: {:?}", report.terminal());

Implementations§

Source§

impl StandardWebDecisionRuntime

Source

pub async fn run_api_visibility_pair( &mut self, request: ApiVisibilityDifferentialRequest, ) -> Result<RuntimeApiVisibilityRunReport, RuntimeApiVisibilityExecutionError>

Executes one authorized, same-target JSON authorization-context pair.

Both legs use isolated broker pools backed by the runtime’s shared accounting authority, are charged as active verifications, and are independently cancellation/budget bounded. Only two complete JSON views reach Comparator V3 and atomic observation ingestion. A difference can yield ApiVisibilityDifferentialDisposition::AwaitHumanReview, never a vulnerability verdict or decision-loop success.

Once pre-I/O configuration and target checks pass, this operation consumes the runtime’s single-use execution right even on cancellation or transport failure. Use another runtime instance for the standard endpoint analysis workflow.

§Examples
use url::Url;
use termivar_scanner::{
    ApiComparisonProfile, ApiVisibilityContextProbe,
    ApiVisibilityDifferentialRequest, ApiVisibilityDimension, EntityId,
    HttpProbe, HttpProbeMethod, StandardWebDecisionRuntime,
};

let target = Url::parse("https://example.test/api/account")?;
let control = HttpProbe::new(target.clone(), HttpProbeMethod::Get)?
    .with_header("authorization", "Bearer control-context")?;
let candidate = HttpProbe::new(target.clone(), HttpProbeMethod::Get)?
    .with_header("authorization", "Bearer candidate-context")?;
let request = ApiVisibilityDifferentialRequest::new(
    "comparison-1",
    EntityId::new("resource:account")?,
    ApiVisibilityContextProbe::new("context:control", control)?,
    ApiVisibilityContextProbe::new("context:candidate", candidate)?,
    ["authorization"],
    ApiComparisonProfile::default(),
    ApiVisibilityDimension::Fields,
    1_800_000_000_000,
)?;
let mut runtime = StandardWebDecisionRuntime::builder(target)
    .enable_api_reasoning()
    .build()?;

let report = runtime.run_api_visibility_pair(request).await?;
assert_eq!(report.audit().usage().total_requests(), 2);
Source§

impl StandardWebDecisionRuntime

Source

pub fn ingest_api_visibility( &mut self, observation: ApiVisibilityObservation, expected_resource: &EntityId, ) -> Result<ApiObservationReceipt, RuntimeApiVisibilityError>

Commits one authorized, host-paired API visibility observation.

The runtime must have API reasoning enabled. Disabled runtimes reject the call before any write. The host remains responsible for authenticating the producer, authorizing both compared contexts, and asserting that expected_resource is the same logical resource in both views.

This boundary accepts no raw response, URL, header, credential, or principal. It preserves the observation’s isolated comparison subject and never rewrites it to the runtime endpoint subject. Ingestion performs no request and does not change runtime usage, experience, planning, or decision-session state. Exact replay remains idempotent.

§Examples
use url::Url;
use termivar_scanner::{
    ApiSurfaceKind, ApiVisibilityComparison, ApiVisibilityDimension,
    ApiVisibilityPairKind, ApiVisibilityResult, ApiVisibilityReviewQuery,
    ConfidenceScore, EntityId, StandardWebDecisionRuntime,
};

let resource = EntityId::new("resource:account-42")?;
let observation = ApiVisibilityComparison::new(
    "comparison-17",
    ApiSurfaceKind::JsonHttp,
    ApiVisibilityPairKind::AuthorizationContext,
    ApiVisibilityResult::Different,
    ApiVisibilityDimension::Fields,
    "anonymous-view",
    "member-view",
    resource.as_str(),
)?
.to_observation("host.api-comparator", ConfidenceScore::MAX)?;
let mut runtime = StandardWebDecisionRuntime::builder(
    Url::parse("https://example.test/api/accounts/42")?,
)
.enable_api_reasoning()
.build()?;

runtime.ingest_api_visibility(observation, &resource)?;
let page = runtime.api_visibility_reviews(
    &resource,
    &ApiVisibilityReviewQuery::default(),
)?;
assert_eq!(page.reviews().len(), 1);
Source

pub fn api_visibility_reviews( &self, resource: &EntityId, query: &ApiVisibilityReviewQuery, ) -> Result<ApiVisibilityReviewPage, RuntimeApiVisibilityError>

Returns one cursor-bounded page of paired-visibility reviews.

Review projection is available only when API reasoning was explicitly enabled. It reads the runtime’s comparison subjects without feeding their hypotheses into the endpoint planner or decision session.

Source§

impl StandardWebDecisionRuntime

Source

pub fn builder(target: Url) -> StandardWebDecisionRuntimeBuilder

Starts a target-scoped runtime builder.

Source

pub fn target(&self) -> &Url

Returns the authorized target supplied by the host.

Source

pub fn subject(&self) -> &EntityId

Returns the stable endpoint subject used by every runtime layer.

Source

pub fn installation(&self) -> StandardWebDecisionInstallReport

Returns the standard profile installation receipt.

Source

pub fn api_reasoning_installation(&self) -> Option<StandardApiInstallReport>

Returns the passive API reasoning installation receipt when enabled.

Source

pub fn unsupported_actions(&self) -> &BTreeSet<String>

Returns actions omitted because no executor was installed for them.

Source

pub fn knowledge(&self) -> &KnowledgeBase

Returns the runtime knowledge base for audit and reporting.

Source

pub fn experience(&self) -> &ExperienceStore

Returns learned target-scoped outcomes.

Source

pub fn session(&self) -> &DecisionSession

Returns the replayable session state.

Source

pub const fn budget(&self) -> RuntimeBudget

Returns the immutable resource envelope for this session.

Source

pub fn usage(&self) -> &RuntimeUsage

Returns current resource accounting, including failed request attempts.

Source

pub fn cancellation_token(&self) -> CancellationToken

Returns a clone of the host-owned cancellation token.

Cancelling the returned token stops this single-use runtime at its next async or deterministic planning boundary.

Source

pub fn has_started(&self) -> bool

Returns whether execution has been attempted.

Source

pub fn into_experience(self) -> ExperienceStore

Consumes the runtime and returns its learned experience.

Source

pub async fn analyze( &mut self, ) -> Result<StandardWebDecisionRunReport, StandardWebDecisionRuntimeError>

Collects bootstrap evidence and drives commands to a terminal state.

The runtime is single-use even when execution returns an error. This prevents a caller from replaying a partially committed network session under the same deterministic case identities.

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

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.

§

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

§

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
§

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> Same for T

Source§

type Output = T

Should always be Self
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<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