Files
codex/codex-rs/guardian-context/src/section.rs
T
ioanbudea-OAI 603a7baff0 Centralize synchronous Guardian context preparation (#57494)
## What changed

- Retain captured root conversation sources until synchronous preparation applies request limits. Keep asynchronous snapshots limited to the bounded messages.
- Move approval-reason truncation and tool-description escaping and truncation from composition into preparation.
- Extract synchronous image preparation and admission into `guardian-context`, preserving the prompt token cap and model context-window checks.

GitOrigin-RevId: d3a864c77d8f16bd3e77df436d80c4d2738c43cc
2026-10-27 15:53:50 +00:00

46 lines
1.5 KiB
Rust

//! Section identities survive consumer-specific transcript selection and rendering.
use crate::ConversationTranscriptEntry;
use crate::PlannedAction;
use crate::PreviousReviews;
use crate::RenderedNodeReplEvidence;
use crate::RetainedInstructionItem;
use crate::TranscriptImages;
use crate::TrustedSkills;
use crate::TrustedTool;
/// Ordered evidence with a stable section identity and source-specific content.
///
/// Variants preserve provenance: transcript entries carry their original roles,
/// root messages remain line-role-labeled, and answers are host-verified fragments.
/// Conversation, authorization and action evidence retain user-role delivery.
/// Host-attested reviews and tool identities use separate developer messages.
/// Review actions/rationales and remote tool descriptions remain untrusted.
#[derive(Clone, Debug, PartialEq)]
pub enum ContextSection<T = ConversationTranscriptEntry> {
ConversationTranscript {
items: Vec<T>,
},
RootConversation {
content: crate::RootConversationContent,
},
TrustedUserAnswers {
items: Vec<crate::TrustedUserAnswer>,
},
RetainedUserInstructions {
items: Vec<RetainedInstructionItem>,
},
SenderUserMessages {
items: Vec<String>,
},
PlannedAction(PlannedAction),
PreviousReviews(PreviousReviews),
TrustedTool(TrustedTool),
TrustedSkills(TrustedSkills),
TranscriptImages(TranscriptImages),
NodeReplEvidence(RenderedNodeReplEvidence),
PermissionContext {
items: Vec<String>,
},
}