Skip to main content

Harness

Struct Harness 

Source
pub struct Harness {
    pub handle: SessionHandle,
    pub provider: Arc<ScriptedProvider>,
    pub seen: Vec<String>,
    pub ask_reply: AskReply,
    pub steer_on_tool_start: Option<String>,
    pub steer_on_text_delta: Option<String>,
    pub snapshots: Arc<Mutex<Vec<String>>>,
    pub ledger_reports: Vec<LedgerSummary>,
    /* private fields */
}

Fields§

§handle: SessionHandle§provider: Arc<ScriptedProvider>§seen: Vec<String>

Debug strings of every event seen, in order.

§ask_reply: AskReply

Answer for every Ask event (T1: defaults to Allow).

§steer_on_tool_start: Option<String>

One-shot steer to send when the next ToolStart is observed.

§steer_on_text_delta: Option<String>

One-shot steer to send when the next stream delta is observed — i.e. inside a sample window. Deterministic only with Harness::with_paused_completion, which holds the stream open long enough for the steer to reach the actor before the sample closes.

§snapshots: Arc<Mutex<Vec<String>>>

Labels of every shadow snapshot the engine requested, in order.

§ledger_reports: Vec<LedgerSummary>

Every EngineEvent::LedgerReport seen, in order (§S1 instrument).

Implementations§

Source§

impl Harness

Source

pub fn dir(&self) -> &Path

The harness working directory (the engine’s cwd for subdir hints; also a scratch space for files the scripted tools touch).

Source

pub fn keep_dir(&mut self, dir: TempDir)

Tie a fixture temp dir’s lifetime to the harness (it is removed when the harness drops, instead of being forgotten and leaked on disk).

Source

pub fn log_path(&self) -> &Path

The session log this harness writes — for scenarios whose scripted tools have to read the canon while the turn is still running.

Source§

impl Harness

Source

pub fn new( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, ) -> Self

Source

pub fn with_items( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, initial_items: Vec<Item>, ) -> Self

Construct a harness with a pre-seeded projection (resume scenarios).

Source

pub fn with_hooks( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, hooks: Arc<dyn Hooks>, ) -> Self

Construct a harness with extension hooks (M5 scenarios).

Source

pub fn with_registry( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, registry: Registry, ) -> Self

Construct a harness with a custom tool registry (concurrency probes, scripted tools).

Source

pub fn with_items_and_registry( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, initial_items: Vec<Item>, registry: Registry, ) -> Self

Construct a harness with a pre-seeded projection and a custom registry. The cache-prefix scenarios need both at once: a history long enough that the breakpoint planner has already placed a rolling anchor, and the scripted tools whose batches grow it.

Source

pub fn with_registry_sync_noop( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, registry: Registry, ) -> Self

Construct a harness with a custom tool registry and the writer’s sync_data() no-op’d (hotl_store::SessionLog::set_sync_noop) — the §S1 loop-overhead CI gate’s scenario, isolating measured overhead from real disk sync latency.

Source

pub fn with_paused_completion( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, pause: Duration, ) -> Self

Construct a harness whose every sample stalls before completing — see [PausedCompletion]. Pair with Harness::steer_on_text_delta.

Source

pub fn with_rules( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, rules: Rules, ) -> Self

Construct a harness with custom permission rules (mode/deny/admin scenarios).

Source

pub fn fsync_count(&self) -> u64

sync_data() calls the session’s writer has completed so far.

Source

pub async fn prompt_and_wait(&mut self, text: &str) -> Outcome

Send a prompt and drain events until the turn finishes.

Source

pub async fn wait_for_outcome(&mut self) -> Outcome

Source

pub fn kinds(&self) -> Vec<String>

The persisted entry kinds, in order — the coarse golden signature.

Source

pub fn transcript(&self) -> String

The full normalized transcript: ids/parents/timestamps zeroed so runs are byte-comparable.

Source

pub fn entries(&self) -> Vec<Entry>

Source

pub fn items(&self) -> Vec<Item>

Conversation items as persisted, in order.

Source

pub fn tool_calls(&self) -> Vec<(String, Value)>

(tool name, input) for every persisted assistant tool_use, in log order — the trajectory a scenario produced.

Source

pub fn assert_trajectory(&self, expected: &[&str], mode: TrajectoryMatch)

Assert on the tool-call sequence a scenario produced (not just entry kinds). Panics — with both sequences — when the mode’s relation fails.

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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, 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.
Source§

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

Source§

fn vzip(self) -> V

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