Process the conversation and return Claude Code's assistant text.
A thread's first turn sends the FULL history and lets the CLI mint a
session; later turns --resume it and send only the delta.
This method owns ALL session-map policy — every read, write, and eviction of
this.sessions happens here; runTurn is a pure one-spawn helper that
mutates no instance state. A resume turn evicts its id ONLY when the failure
is a genuinely stale session (isStaleSessionError); every other
failure (auth, rate limit, unknown model, signal, timeout, or the
client-side empty-delta guard that never even spawned) leaves the cached
session untouched — the server session may well still be valid.
On a stale session the behaviour is replayOnLostSession's to decide: by
default the turn rejects; when opted in, the rebuild happens INSIDE this same
turn. It cannot be deferred to "the next turn": ScenarioExecution rethrows
whatever an adapter's call() throws, which aborts the run — so a rejected
turn has no successor to rebuild on.
Scenario agent input (conversation history etc.).
The concatenated assistant-visible text as a string.
Adapter that runs the Claude Code CLI as a Scenario agent.
Example