Add displayPrompt support to session.send across all SDKs#1470
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support in the Rust SDK for an optional “display-only” prompt label when sending a message, aligning Rust with the existing displayPrompt parameter used in other language SDKs and the JSON-RPC schema.
Changes:
- Extend
MessageOptionswithdisplay_prompt: Option<String>plus awith_display_prompt()builder. - Include
displayPromptin thesession.sendJSON-RPC params whendisplay_promptis set.
Show a summary per file
| File | Description |
|---|---|
| rust/src/types.rs | Adds the display_prompt option and builder method to MessageOptions. |
| rust/src/session.rs | Serializes displayPrompt into session.send params when provided. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Add display_prompt field to MessageOptions that gets serialized as displayPrompt in the session.send JSON-RPC params. This allows callers to specify a different prompt to display to users than what is sent to the model. Includes integration tests verifying: - displayPrompt is included with expected value when set - displayPrompt is omitted when not set Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bd7a3bc to
1246929
Compare
Pass the displayPrompt option through to the session.send RPC call in each SDK, matching the Rust implementation in this PR. When provided, displayPrompt is shown in the timeline instead of the actual prompt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency ReviewThis PR adds The .NET SDK needs updates in three places: 1. /// <summary>
/// If provided, this is shown in the timeline instead of <see cref="Prompt"/>.
/// </summary>
public string? DisplayPrompt { get; set; }Also update the 2. [JsonPropertyName("displayPrompt")]
public string? DisplayPrompt { get; init; }3. DisplayPrompt = options.DisplayPrompt,Without these changes, .NET consumers won't be able to set a display prompt, creating a feature gap relative to the other four SDKs.
|
- Reformat Java Javadoc comments to satisfy Spotless line-length rules - Add DisplayPrompt to .NET MessageOptions, SendMessageRequest, and SendAsync method to close the feature gap Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Add a
displayPromptfield to thesession.sendRPC params across all language SDKs. When provided, this value is shown in the conversation timeline instead of the actual prompt text.Changes
rust/src/types.rs,rust/src/session.rs): Addeddisplay_prompt: Option<String>field toMessageOptionswith awith_display_prompt()builder method, serialized asdisplayPromptin params.nodejs/src/types.ts,nodejs/src/session.ts): Added optionaldisplayPrompttoMessageOptionsinterface and pass it through insend().python/copilot/session.py): Addeddisplay_promptkeyword argument tosend()andsend_and_wait().go/types.go,go/session.go): AddedDisplayPromptfield toMessageOptionsandsessionSendRequest.java/src/main/java/.../rpc/MessageOptions.java,SendMessageRequest.java,CopilotSession.java): AddeddisplayPromptfield with getter/setter and pass it insend().dotnet/src/Types.cs,dotnet/src/Session.cs): AddedDisplayPromptproperty toMessageOptionsandSendMessageRequest, passed inSendAsync().Motivation
The GitHub app sends prompts that may contain additional context (e.g., canvas context, system instructions) prepended to the user's message. The
displayPromptfield lets the app tell the runtime what to show in the timeline as the user's message, rather than showing the full enriched prompt.