mirror of
https://github.com/openai/codex.git
synced 2026-05-01 09:56:37 +00:00
Record realtime close marker on replacement (#13058)
## Summary - record a realtime close developer message when a new realtime session replaces an active one - assert the replacement marker through the mocked responses request path --------- Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Charles Cunningham <ccunningham@openai.com>
This commit is contained in:
@@ -14,6 +14,8 @@ use crate::protocol::AskForApproval;
|
||||
use crate::protocol::COLLABORATION_MODE_CLOSE_TAG;
|
||||
use crate::protocol::COLLABORATION_MODE_OPEN_TAG;
|
||||
use crate::protocol::NetworkAccess;
|
||||
use crate::protocol::REALTIME_CONVERSATION_CLOSE_TAG;
|
||||
use crate::protocol::REALTIME_CONVERSATION_OPEN_TAG;
|
||||
use crate::protocol::SandboxPolicy;
|
||||
use crate::protocol::WritableRoot;
|
||||
use crate::user_input::UserInput;
|
||||
@@ -340,6 +342,9 @@ const SANDBOX_MODE_WORKSPACE_WRITE: &str =
|
||||
include_str!("prompts/permissions/sandbox_mode/workspace_write.md");
|
||||
const SANDBOX_MODE_READ_ONLY: &str = include_str!("prompts/permissions/sandbox_mode/read_only.md");
|
||||
|
||||
const REALTIME_START_INSTRUCTIONS: &str = include_str!("prompts/realtime/realtime_start.md");
|
||||
const REALTIME_END_INSTRUCTIONS: &str = include_str!("prompts/realtime/realtime_end.md");
|
||||
|
||||
impl DeveloperInstructions {
|
||||
pub fn new<T: Into<String>>(text: T) -> Self {
|
||||
Self { text: text.into() }
|
||||
@@ -409,6 +414,20 @@ impl DeveloperInstructions {
|
||||
))
|
||||
}
|
||||
|
||||
pub fn realtime_start_message() -> Self {
|
||||
DeveloperInstructions::new(format!(
|
||||
"{REALTIME_CONVERSATION_OPEN_TAG}\n{}\n{REALTIME_CONVERSATION_CLOSE_TAG}",
|
||||
REALTIME_START_INSTRUCTIONS.trim()
|
||||
))
|
||||
}
|
||||
|
||||
pub fn realtime_end_message(reason: &str) -> Self {
|
||||
DeveloperInstructions::new(format!(
|
||||
"{REALTIME_CONVERSATION_OPEN_TAG}\n{}\n\nReason: {reason}\n{REALTIME_CONVERSATION_CLOSE_TAG}",
|
||||
REALTIME_END_INSTRUCTIONS.trim()
|
||||
))
|
||||
}
|
||||
|
||||
pub fn personality_spec_message(spec: String) -> Self {
|
||||
let message = format!(
|
||||
"<personality_spec> The user has requested a new communication style. Future messages should adhere to the following personality: \n{spec} </personality_spec>"
|
||||
|
||||
Reference in New Issue
Block a user