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
This commit is contained in:
joeytrasatti-openai authored and copyberry committed 2026-08-10 23:32:42 +00:00
1 parent 92912d6d84
commit 1549756b78
54 files changed
+939 -47

No files matched your search

@@ -7,6 +7,7 @@ use super::Thread;
use super::ThreadHistoryMode;
use super::ThreadItem;
use super::ThreadSection;
use super::ThreadSectionAppearance;
use super::ThreadSource;
use super::Turn;
use super::TurnEnvironmentParams;
@@ -1146,6 +1147,9 @@ pub struct ThreadSectionListResponse {
pub struct ThreadSectionCreateParams {
/// The user-visible name of the section.
pub name: String,
#[serde(default)]
#[ts(optional = nullable)]
pub appearance: Option<ThreadSectionAppearance>,
}
/// The independently persisted section created by the server.
@@ -1165,6 +1169,16 @@ pub struct ThreadSectionUpdateParams {
pub section_id: String,
/// The updated user-visible name of the section.
pub name: String,
/// Omit to preserve appearance, use `null` to clear it, or provide a replacement.
#[serde(
default,
skip_serializing_if = "Option::is_none",
serialize_with = "crate::protocol::serde_helpers::serialize_double_option",
deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option"
)]
#[schemars(with = "Option<ThreadSectionAppearance>")]
#[ts(optional = nullable, as = "Option<ThreadSectionAppearance>")]
pub appearance: Option<Option<ThreadSectionAppearance>>,
}
/// The independently persisted section after its name is updated.