mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
[codex] Make thread store turn filter optional (#28949)
Make `ListItemsParams::turn_id` optional so callers can list persisted items across an entire thread or narrow the result to one turn. This aligns the thread-store API and documentation with thread-wide item listing while preserving the optional turn-filter behavior for implementations.
This commit is contained in:
3 files changed
+6
-6
No files matched your search
@@ -79,7 +79,7 @@ mod tests {
|
|||||||
let items_err = store
|
let items_err = store
|
||||||
.list_items(ListItemsParams {
|
.list_items(ListItemsParams {
|
||||||
thread_id,
|
thread_id,
|
||||||
turn_id: "turn_1".to_string(),
|
turn_id: None,
|
||||||
include_archived: true,
|
include_archived: true,
|
||||||
cursor: None,
|
cursor: None,
|
||||||
page_size: 10,
|
page_size: 10,
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ pub trait ThreadStore: Any + Send + Sync {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lists persisted items within a stored turn.
|
/// Lists persisted items within a stored thread, optionally filtered to a turn.
|
||||||
fn list_items(&self, _params: ListItemsParams) -> ThreadStoreFuture<'_, ItemPage> {
|
fn list_items(&self, _params: ListItemsParams) -> ThreadStoreFuture<'_, ItemPage> {
|
||||||
Box::pin(async {
|
Box::pin(async {
|
||||||
Err(ThreadStoreError::Unsupported {
|
Err(ThreadStoreError::Unsupported {
|
||||||
|
|||||||
@@ -334,13 +334,13 @@ pub struct TurnPage {
|
|||||||
pub backwards_cursor: Option<String>,
|
pub backwards_cursor: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parameters for listing persisted items within a single turn.
|
/// Parameters for listing persisted items within a thread.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct ListItemsParams {
|
pub struct ListItemsParams {
|
||||||
/// Thread id to read.
|
/// Thread id to read.
|
||||||
pub thread_id: ThreadId,
|
pub thread_id: ThreadId,
|
||||||
/// Turn id to hydrate.
|
/// Optional turn id to filter by. When omitted, returns items across the thread.
|
||||||
pub turn_id: String,
|
pub turn_id: Option<String>,
|
||||||
/// Whether archived threads are eligible.
|
/// Whether archived threads are eligible.
|
||||||
pub include_archived: bool,
|
pub include_archived: bool,
|
||||||
/// Opaque cursor returned by a previous list call.
|
/// Opaque cursor returned by a previous list call.
|
||||||
@@ -361,7 +361,7 @@ pub struct StoredThreadItem {
|
|||||||
pub materialized_thread_item_json: Vec<u8>,
|
pub materialized_thread_item_json: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A page of persisted items within a turn.
|
/// A page of persisted items within a thread, optionally filtered to a turn.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct ItemPage {
|
pub struct ItemPage {
|
||||||
/// Items returned for this page.
|
/// Items returned for this page.
|
||||||
|
|||||||
Reference in new issue
Block a user