mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
## What changed - Represent compaction summaries and Guardian-approved actions as typed contextual fragments. - Inject subagent notifications through the same fragment path. - Annotate the resulting request items with `compaction.summary`, `guardian.approved_action`, and `multi_agent.subagent_notification` content kinds while preserving their existing roles and text. ## Testing - Verify the content-kind metadata on compacted summaries, approved actions, and subagent notifications. GitOrigin-RevId: 01c93e7f08b2dc1c1e85ba69e82bfb5f56e6cca5
38 lines
802 B
Rust
38 lines
802 B
Rust
use super::ContextualUserFragment;
|
|
use codex_protocol::models::ContentItemKind;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub(crate) struct CompactionSummary {
|
|
summary: String,
|
|
}
|
|
|
|
impl CompactionSummary {
|
|
pub(crate) fn new(summary: impl Into<String>) -> Self {
|
|
Self {
|
|
summary: summary.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl ContextualUserFragment for CompactionSummary {
|
|
fn content_kind(&self) -> ContentItemKind {
|
|
ContentItemKind("compaction.summary".to_string())
|
|
}
|
|
|
|
fn role(&self) -> &'static str {
|
|
"user"
|
|
}
|
|
|
|
fn markers(&self) -> (&'static str, &'static str) {
|
|
Self::type_markers()
|
|
}
|
|
|
|
fn type_markers() -> (&'static str, &'static str) {
|
|
("", "")
|
|
}
|
|
|
|
fn body(&self) -> String {
|
|
self.summary.clone()
|
|
}
|
|
}
|