Back-reference to the ScenarioExecution that owns this state.
The voice adapter runtime (see voice/adapter.runtime.ts) reads this
to reach the executor's import("../voice/voice-executor-state").VoiceExecutorState surface
(voiceRecording, voiceTimeline, voiceLatency, etc.). Mirrors
Python ScenarioState._executor.
Underscored to keep callers out of the internal coupling — only the voice subsystem reaches in. Set once by the constructor of ScenarioExecution via setExecutor.
The scenario configuration.
The scenario description.
Readonlyevents$Every chunk the agent retrieved across the run so far, from the rag spans of the traces.
The judge criteria of the scenario, in order.
The current turn number in the scenario.
The current turn number in the scenario.
The fields the scenario carries next to its description, its data row.
The sequence of messages exchanged during the scenario.
Every span of every trace of the run collected so far, in start order. Never fetches: a script step reads what the collector holds.
The unique identifier for the execution thread.
The unique identifier for the execution thread.
One entry per trace id the messages carry, in first-seen order.
One entry per turn, with the messages added during it.
Adds a message to the conversation history.
The message to add.
One field of the scenario. Nothing when the scenario does not set it or
leaves it blank; 0 and false are values.
The text of the first message the simulated user sent, or an empty string before the first user message.
Checks if a tool call for a specific tool exists in the execution state.
The name of the tool.
True if the tool call exists, false otherwise.
Retrieves the last agent message from the execution state.
The last agent message.
Retrieves the last message from the execution state.
The last message.
Retrieves the last tool call message for a specific tool.
The name of the tool.
The last tool call message.
Retrieves the last user message from the execution state.
The last user message.
Remove all messages from position index onward.
Truncates the internal message list and notifies the executor (via the registered rollback handler) to clean pending queues.
Note: This method is safe to call only during an agent's call()
invocation. The executor runs agents sequentially, so no other agent
can observe stale newMessages references. Calling this from outside
that flow may leave already-delivered newMessages out of sync.
Truncate point (clamped to [0, messages.length]).
Messages at positions >= index are removed.
The removed messages (empty array if nothing to remove).
Set the back-reference; called once by the executor's constructor.
Register a callback that fires when messages are rolled back. The executor uses this to clean up its pending message queues.
Sets where spans reads from: the executor points it at the judge span
collector for this thread. Reading never fetches remote traces.
Starts recording what the next reads touch, so the evaluator runner knows whether a mapping read the trace and what it found missing.
Stops recording and returns what was read since tracking started.
Every call of a tool across the run so far, in start order, merged from
the tool calls of the assistant messages and the tool spans of the
traces. toolCalls("run_sql").last?.input is the arguments of the last
call. Without a name, every tool call of the run.
Optionalname: stringThe conversation so far as one role: content line per message.
Manages the state of a scenario execution. This class implements the ScenarioExecutionStateLike interface and provides the internal logic for tracking conversation history, turns, results, and other related information.