mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Move persistence policy application into ThreadStore (#27318)
Move the application of the persistence policy into the thread store, so thread stores can get raw append items rather than canonical append items. This will enable store-specific projections over the raw input items.
This commit is contained in:
@@ -124,6 +124,14 @@ impl ThreadHistoryBuilder {
|
||||
.or_else(|| self.turns.last().cloned())
|
||||
}
|
||||
|
||||
pub fn turn_snapshot(&self, turn_id: &str) -> Option<Turn> {
|
||||
self.current_turn
|
||||
.as_ref()
|
||||
.filter(|turn| turn.id == turn_id)
|
||||
.map(Turn::from)
|
||||
.or_else(|| self.turns.iter().find(|turn| turn.id == turn_id).cloned())
|
||||
}
|
||||
|
||||
/// Returns the index of the active turn snapshot within the finished turn list.
|
||||
///
|
||||
/// When a turn is still open, this is the index it will occupy after
|
||||
|
||||
Reference in New Issue
Block a user