// The operator's starred chats. A star is a local preference, not part of the // server's chat record, so it survives reloads on this device and never mutates // the session. Starred sessions sort above everything else. export const CHAT_STARS_KEY = "pipelines.web.chatStars.v1"; export function readChatStars(storage = globalThis.localStorage) { try { const parsed = JSON.parse(storage?.getItem(CHAT_STARS_KEY) ?? "[]"); return new Set(Array.isArray(parsed) ? parsed.filter((id) => typeof id === "string" && id !== "") : []); } catch { return new Set(); } } export function writeChatStars(stars, storage = globalThis.localStorage) { try { storage?.setItem(CHAT_STARS_KEY, JSON.stringify([...stars])); } catch { // Storage may be unavailable; the in-memory choice still applies. } }