Skip to content

Commit f95bbe6

Browse files
devm33Copilot
andcommitted
rust: Add display_prompt to MessageOptions for session.send
Add a display_prompt field to MessageOptions that, when set, is serialized as displayPrompt in the session.send JSON-RPC params. This allows consumers to specify a user-facing label for the timeline that differs from the actual prompt sent to the agent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 102cd3e commit f95bbe6

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

rust/src/session.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ impl Session {
371371
{
372372
params["requestHeaders"] = serde_json::to_value(headers)?;
373373
}
374+
if let Some(display_prompt) = opts.display_prompt {
375+
params["displayPrompt"] = serde_json::to_value(display_prompt)?;
376+
}
374377
let trace_ctx = if opts.traceparent.is_some() || opts.tracestate.is_some() {
375378
TraceContext {
376379
traceparent: opts.traceparent,

rust/src/types.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,6 +3107,8 @@ pub struct MessageOptions {
31073107
///
31083108
/// Per-turn override paired with [`traceparent`](Self::traceparent).
31093109
pub tracestate: Option<String>,
3110+
/// If provided, this is shown in the timeline instead of `prompt`.
3111+
pub display_prompt: Option<String>,
31103112
}
31113113

31123114
impl MessageOptions {
@@ -3121,6 +3123,7 @@ impl MessageOptions {
31213123
request_headers: None,
31223124
traceparent: None,
31233125
tracestate: None,
3126+
display_prompt: None,
31243127
}
31253128
}
31263129

@@ -3181,6 +3184,12 @@ impl MessageOptions {
31813184
self.tracestate = Some(tracestate.into());
31823185
self
31833186
}
3187+
3188+
/// Set the display prompt shown in the timeline instead of `prompt`.
3189+
pub fn with_display_prompt(mut self, display_prompt: impl Into<String>) -> Self {
3190+
self.display_prompt = Some(display_prompt.into());
3191+
self
3192+
}
31843193
}
31853194

31863195
impl From<&str> for MessageOptions {

0 commit comments

Comments
 (0)