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: AskReplyAnswer 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
impl Harness
Sourcepub fn dir(&self) -> &Path
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§impl Harness
impl Harness
pub fn new( scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>, config: EngineConfig, ) -> Self
Sourcepub fn with_items(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
initial_items: Vec<Item>,
) -> Self
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).
Sourcepub fn with_hooks(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
hooks: Arc<dyn Hooks>,
) -> Self
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).
Sourcepub fn with_registry(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
registry: Registry,
) -> Self
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).
Sourcepub fn with_items_and_registry(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
initial_items: Vec<Item>,
registry: Registry,
) -> Self
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.
Sourcepub fn with_registry_sync_noop(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
registry: Registry,
) -> Self
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.
Sourcepub fn with_paused_completion(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
pause: Duration,
) -> Self
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.
Sourcepub fn with_rules(
scripts: Vec<Vec<Result<StreamEvent, ProviderError>>>,
config: EngineConfig,
rules: Rules,
) -> Self
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).
Sourcepub fn fsync_count(&self) -> u64
pub fn fsync_count(&self) -> u64
sync_data() calls the session’s writer has completed so far.
Sourcepub async fn prompt_and_wait(&mut self, text: &str) -> Outcome
pub async fn prompt_and_wait(&mut self, text: &str) -> Outcome
Send a prompt and drain events until the turn finishes.
pub async fn wait_for_outcome(&mut self) -> Outcome
Sourcepub fn kinds(&self) -> Vec<String>
pub fn kinds(&self) -> Vec<String>
The persisted entry kinds, in order — the coarse golden signature.
Sourcepub fn transcript(&self) -> String
pub fn transcript(&self) -> String
The full normalized transcript: ids/parents/timestamps zeroed so runs are byte-comparable.
pub fn entries(&self) -> Vec<Entry>
Sourcepub fn tool_calls(&self) -> Vec<(String, Value)>
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.
Sourcepub fn assert_trajectory(&self, expected: &[&str], mode: TrajectoryMatch)
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.