Files
codex/codex-rs/thread-store/src/thread_sections.rs
joeytrasatti-openai c42ea41ee0 Add thread section management APIs (#36380)
## What changed

- Add `threadSection/create`, `threadSection/update`, and `threadSection/delete` app-server methods, with generated protocol schemas and TypeScript bindings.
- Persist custom sections in SQLite with stable UUIDv7 identities, trim and validate display names, and prevent renaming or deleting the built-in pinned section.
- Delete sections transactionally and return their active and archived threads to the unsectioned list.
- Serialize section mutations with section listing so concurrent requests observe ordered updates.

## Testing

- Cover section persistence across restarts, ordered renames, member cleanup on deletion, invalid requests, unsupported stores, and thread-store/state-runtime behavior.

GitOrigin-RevId: dc9a4be283c21dbc93ab1829eafc4825d8df6575
2026-07-31 19:08:45 +00:00

50 lines
1.5 KiB
Rust

/// Parameters for listing independently persisted thread sections.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ListThreadSectionsParams {
/// Opaque cursor returned by a previous section listing.
pub cursor: Option<String>,
/// Maximum number of sections to return.
pub limit: usize,
}
/// Parameters for creating a thread section.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CreateThreadSectionParams {
/// User-facing section name.
pub name: String,
}
/// Parameters for renaming a thread section.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RenameThreadSectionParams {
/// Stable identifier of the section to rename.
pub section_id: String,
/// Replacement user-facing section name.
pub name: String,
}
/// Parameters for deleting a thread section.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DeleteThreadSectionParams {
/// Stable identifier of the section to delete.
pub section_id: String,
}
/// An independently persisted thread section and its user-facing name.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StoredThreadSection {
/// Stable, server-owned section identifier.
pub id: String,
/// User-facing section name.
pub name: String,
}
/// A cursor-paginated page of independently persisted thread sections.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StoredThreadSectionsPage {
/// Sections returned for this page.
pub sections: Vec<StoredThreadSection>,
/// Opaque cursor to continue listing sections.
pub next_cursor: Option<String>,
}