pub struct NativeTurnInput {
pub prompt_text: String,
pub system_prompt: Option<String>,
pub attachments: Vec<UserAttachment>,
pub cancel_token: Option<CancellationToken>,
pub prior_messages: Vec<ChatMessage>,
pub context_path: Option<PathBuf>,
pub turn_end_grace: Option<Duration>,
}Fields§
§prompt_text: StringThe user-facing prompt that triggered this turn. Lands as the first
ChatMessage::User.content the model sees.
system_prompt: Option<String>Pre-composed system prompt (e.g. spec_snapshot.system_prompt +
driver.append_system_prompt). None ⇒ no system message sent.
attachments: Vec<UserAttachment>Non-text attachments lifted from the inbound UserMessagePayload
content blocks. Empty Vec ⇒ pure-text prompt. Lands on the first
ChatMessage::User.attachments so each provider’s projection
can render them as image / file content blocks.
cancel_token: Option<CancellationToken>Optional cancellation handle. When fired, the harness loop
short-circuits at the next stream-chunk await (or before the
next step starts) and emits TurnEnd { stop_reason: "interrupt" }.
None ⇒ harness cannot be cancelled mid-flight (fine for tests
and for fire-and-forget turns); production wires this through
from RD’s active_native_cancel.
prior_messages: Vec<ChatMessage>Prior messages history for in-memory mode (context_path = None).
Ignored when context_path is Some — harness loads history from
the JSONL file instead.
Empty Vec + context_path = None = fresh in-memory conversation.
context_path: Option<PathBuf>Absolute path to harness’s context JSONL.
-
Some(path)— persistent mode: harness loads prior messages from this file at turn start (creating it on first use), appends new messages incrementally, and rewrites it on compaction.prior_messagesis ignored.TurnEnd.final_messagesis empty. -
None— in-memory mode:prior_messagesis used as the seed; harness never touches the filesystem.TurnEnd.final_messagescarries the full history snapshot for the caller to persist. Suitable for runtime-driver (manages history in RAM) and tests.
turn_end_grace: Option<Duration>How long the loop waits for in-flight tool futures to resolve after
the cancel token fires before publishing TurnEnd{interrupt}.
None falls back to the harness-level grace configured via
crate::agent_loop::AgentLoopHarness::with_turn_end_grace (which
itself defaults to crate::agent_loop::DEFAULT_TURN_END_GRACE,
1s — the historical hard-coded value). Hosts whose tool runtimes
need longer to shut down remote work (e.g. sandbox exec with a
TERM-grace + SIGKILL tail) should raise this so TurnEnd is only
published once writers actually stopped.
Regardless of the window’s outcome, the event carries
TurnEnd.pending_tools: the ids still unresolved when it fired.
Trait Implementations§
Source§impl Clone for NativeTurnInput
impl Clone for NativeTurnInput
Source§fn clone(&self) -> NativeTurnInput
fn clone(&self) -> NativeTurnInput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more