mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
feat(app-server): thread/turns/items/list -> thread/items/list (#29705)
## Description Rename the experimental app-server item pagination API from `thread/turns/items/list` to `thread/items/list` and make `turnId` optional. Clients can now page persisted items across a thread, or still filter to one turn when needed. ## What changed - Rename the request/response protocol types and JSON-RPC method to `ThreadItemsList*` / `thread/items/list`. - Pass optional `turnId` through to `ThreadStore::list_items`. - Update app-server docs and focused protocol/app-server tests. ## Validation - `just test -p codex-app-server-protocol thread_items_list_round_trips` - `just test -p codex-app-server thread_items_list_returns_unsupported`
This commit is contained in:
1 parent
66f0220c56
commit
1882719b30
9 files changed
+132
-38
No files matched your search
@@ -224,10 +224,10 @@ fn thread_resume_response_round_trips_initial_turns_page() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_turns_items_list_round_trips() {
|
||||
let params = ThreadTurnsItemsListParams {
|
||||
fn thread_items_list_round_trips() {
|
||||
let params = ThreadItemsListParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
turn_id: "turn_456".to_string(),
|
||||
turn_id: Some("turn_456".to_string()),
|
||||
cursor: Some("cursor_1".to_string()),
|
||||
limit: Some(50),
|
||||
sort_direction: Some(SortDirection::Asc),
|
||||
@@ -243,7 +243,7 @@ fn thread_turns_items_list_round_trips() {
|
||||
"sortDirection": "asc",
|
||||
})
|
||||
);
|
||||
let response = ThreadTurnsItemsListResponse {
|
||||
let response = ThreadItemsListResponse {
|
||||
data: vec![ThreadItem::ContextCompaction {
|
||||
id: "item_1".to_string(),
|
||||
}],
|
||||
@@ -259,6 +259,32 @@ fn thread_turns_items_list_round_trips() {
|
||||
"backwardsCursor": "cursor_0",
|
||||
})
|
||||
);
|
||||
|
||||
let params_without_turn = ThreadItemsListParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
turn_id: None,
|
||||
cursor: None,
|
||||
limit: None,
|
||||
sort_direction: None,
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
serde_json::to_value(¶ms_without_turn).expect("serialize params without turn"),
|
||||
json!({
|
||||
"threadId": "thr_123",
|
||||
"turnId": null,
|
||||
"cursor": null,
|
||||
"limit": null,
|
||||
"sortDirection": null,
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_value::<ThreadItemsListParams>(json!({
|
||||
"threadId": "thr_123",
|
||||
}))
|
||||
.expect("deserialize params without turn"),
|
||||
params_without_turn
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user