pub async fn run_live_scenario<F, Fut>(
scenario: &str,
options: Options,
drive: F,
) -> Result<Option<()>, Error>where
F: FnOnce(Client, ClientEvents) -> Fut,
Fut: Future<Output = Result<(Client, ClientEvents), Error>>,Expand description
Run a live-capture scenario end-to-end: build options, spawn a recorded
claude, drive the scenario to a Result frame, dump the trace to
target/wire-traces/, assert every inbound line decodes cleanly.
Caller supplies:
scenario: a short slug (e.g."bash_tool") used in trace filenames.options: fully-builtforge_sdk::Options- set tools,permission_mode, hooks, MCP servers, etc. here.drive: async closure that drives the scenario once the client is ready. Typically callssend_user_message(...)and may register turn-specific state.
§Skip semantics
When FORGE_WIRE_CAPTURE is unset, returns Ok(None) immediately
without touching the network - scenarios compile and link in CI but
only run when the developer opts in.
§Errors
Any forge_sdk::Error surfaced during spawn / drive / drain.
Panics on trace-dump failure or decode-completeness failure - those
are harness invariants, not recoverable errors.
§Panics
- Transport panics are propagated.
- Trace file I/O failure.
- Decode-completeness regression in the captured inbound frames.