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 snapshots: Arc<Mutex<Vec<String>>>,
    /* 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.

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

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

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§

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_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 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, 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> 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