Files
codex/codex-rs/thread-store/src/thread_sections.rs
joeytrasatti-openai 1549756b78 Add appearance metadata to thread sections (#37898)
## What changed

- Add optional `icon` and `color` appearance fields to custom thread sections and expose them through the app-server protocol.
- Persist appearance metadata in SQLite and include it when listing sections or returning threads.
- Let `threadSection/update` preserve an omitted appearance, clear it with `null`, or replace it with a new value.
- Reject appearance fields larger than 64 bytes.

## Testing

- Cover protocol compatibility, persistence across restart, update and clear behavior, and field-length validation.

GitOrigin-RevId: 8f55ce4f42f8bd17aa5416848a85845f681953df
2026-08-10 23:32:42 +00:00

53 lines
1.7 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,
pub appearance: Option<codex_state::ThreadSectionAppearance>,
}
/// 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,
pub appearance: Option<Option<codex_state::ThreadSectionAppearance>>,
}
/// 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,
pub appearance: Option<codex_state::ThreadSectionAppearance>,
}
/// 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>,
}