mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
## Why World-state sections could return only a single optional text fragment, with message separation controlled by the fragment itself. They could not contribute explicit `ResponseItem` values alongside instructions. ## What changed - Let sections return ordered `WorldStateUpdate` values containing fragments or response items, with `Prefix`, `Standalone`, or `Mergeable` placement. - Preserve explicit item boundaries when grouping context updates, and place prefix updates first when assembling initial context. - Move standalone-message decisions from fragments to world-state updates and retain snapshot handling. ## Testing Add tests for mixed fragment/item ordering, role and standalone boundaries, initial-context prefix placement, and snapshot restoration without repeated updates. GitOrigin-RevId: c2514c3c98538da83f5140c10a9d89f531de6549
28 lines
659 B
Rust
28 lines
659 B
Rust
use super::ContextualUserFragment;
|
|
use codex_protocol::models::ContentItemKind;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub(crate) struct BaseInstructionsFragment(pub(crate) String);
|
|
|
|
impl ContextualUserFragment for BaseInstructionsFragment {
|
|
fn content_kind(&self) -> ContentItemKind {
|
|
ContentItemKind("model.base_instructions".to_string())
|
|
}
|
|
|
|
fn role(&self) -> &'static str {
|
|
"developer"
|
|
}
|
|
|
|
fn markers(&self) -> (&'static str, &'static str) {
|
|
Self::type_markers()
|
|
}
|
|
|
|
fn type_markers() -> (&'static str, &'static str) {
|
|
("", "")
|
|
}
|
|
|
|
fn body(&self) -> String {
|
|
self.0.clone()
|
|
}
|
|
}
|