Merge: chat colours, Ctrl+1-9, starred chats alphabetical

# Conflicts:
#	app/lib/features/chat/conversation/chat_thread_view.dart
#	app/tool/perf/perf_fixture.dart
#	internal/protocol/chat.go
#	internal/server/chat_close.go
#	internal/server/chat_sessions.go
This commit is contained in:
2026-11-03 11:22:50 +00:00
52 changed files with 1866 additions and 159 deletions
+27 -1
View File
@@ -68,6 +68,14 @@ const (
// device shows the same starred group. It takes a ChatQuery with SessionID
// and Starred, and echoes the updated session like close/reopen.
ChatStar = "chat_star"
// ChatColor records the operator's shared highlight colour for one chat. It
// takes a ChatQuery with SessionID and Color (a ChatColors name; null or ""
// clears it) and echoes the updated session like chat_star.
ChatColor = "chat_color"
// ChatSessionChanged is pushed to every other open connection when a chat's
// shared list metadata (colour, star, title) changes, carrying the updated
// registry row in ChatSession, so each device's list updates live.
ChatSessionChanged = "chat_session_changed"
// ChatSubscribe attaches a connection to one session's shared live stream so
// it receives every frame any client's turn produces (its own and the other
// devices'), not only the frames of a turn it prompted itself. Any number of
@@ -295,6 +303,9 @@ type ChatSession struct {
// NativeExport says chat_export with format "native" can return the
// harness's own session file (today: Claude Code's JSONL transcript).
NativeExport bool `json:"native_export,omitempty"`
// Color is the operator's shared highlight, a ChatColors name; omitted when
// none is set. Clients map the name to their own theme-tuned shade.
Color string `json:"color,omitempty"`
}
// Chat export formats accepted by chat_export.
@@ -323,6 +334,19 @@ type ChatExportFile struct {
Truncated bool `json:"truncated,omitempty"`
}
// ChatColors is the fixed palette of chat highlight names, in picker order.
var ChatColors = []string{"red", "orange", "amber", "green", "teal", "blue", "purple", "pink"}
// ValidChatColor reports whether name is one of ChatColors.
func ValidChatColor(name string) bool {
for _, color := range ChatColors {
if color == name {
return true
}
}
return false
}
// ChatCloseResult reports the outcome of a chat_close: the session id, the
// epoch-millisecond time the closed state was recorded, and whether an
// in-flight turn was interrupted to stop it. It is the record that a running
@@ -380,7 +404,9 @@ type ChatQuery struct {
SessionID string `json:"session_id"`
// Starred is set by chat_star; nil means the command did not name a state.
Starred *bool `json:"starred,omitempty"`
Limit int `json:"limit,omitempty"`
// Color is set by chat_color: a ChatColors name, or nil/"" to clear.
Color *string `json:"color,omitempty"`
Limit int `json:"limit,omitempty"`
// Cursor is the opaque continuation returned by OpenCode's descending
// message listing. It is deliberately not interpreted by the broker.
Cursor string `json:"cursor,omitempty"`