efaa0d9fca
A chat dropped onto the middle of another makes a named group (asked at once, "Group N" by default); onto a group it joins, a group dropped onto a chat takes it in, groups merge. The top level shows each group as a small pile with its name and count; a tap opens it in place under a header that leads back (also the scrim, Back and Escape). In a group, dropping a chat on the header leaves the group; a group of one dissolves. The close button ungroups a dropped group with Undo. Rename, Ungroup, Close all (with Undo), Move to group and Remove from group are in the group menu and as semantic actions. Each open-chat entry carries its group name (protocol field "group", omitted when ungrouped; older clients ignore it), stored and pushed by the server like the order; names are trimmed, printable, at most 80 characters. Needs a server restart to keep groups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.8 KiB
Go
41 lines
1.8 KiB
Go
package protocol
|
|
|
|
// ChatOpenWorkspaceEntry is the server-owned part of one workspace pane. Layout
|
|
// geometry and pane ids deliberately do not cross the wire.
|
|
type ChatOpenWorkspaceEntry struct {
|
|
SessionID string `json:"session_id"`
|
|
Floating bool `json:"floating,omitempty"`
|
|
// Group names the chat group this chat belongs to in the phone's chat
|
|
// stack; entries sharing a name form one group, ordered as the entries
|
|
// are. Empty for an ungrouped chat. Older clients ignore it.
|
|
Group string `json:"group,omitempty"`
|
|
}
|
|
|
|
// ChatOpenWorkspaceGroupLimit bounds a group name, in characters.
|
|
const ChatOpenWorkspaceGroupLimit = 80
|
|
|
|
// ChatOpenWorkspaceRequest replaces the open-chat set. A chat_open_workspace
|
|
// without a request only reads the current snapshot.
|
|
type ChatOpenWorkspaceRequest struct {
|
|
Entries []ChatOpenWorkspaceEntry `json:"entries"`
|
|
// BaseRevision is the snapshot revision the client's entries were derived
|
|
// from. A write whose base is not the current revision is refused, and the
|
|
// reply carries the current snapshot with Rejected set, so a late write
|
|
// can never overwrite a newer change.
|
|
BaseRevision int64 `json:"base_revision"`
|
|
// Seed is honored only when the server has never stored a workspace. It
|
|
// makes migration from the old device-local snapshot race-safe; otherwise
|
|
// the reply is the existing snapshot, unchanged.
|
|
Seed bool `json:"seed,omitempty"`
|
|
}
|
|
|
|
// ChatOpenWorkspaceSnapshot is the complete open-chat set. Revision grows by
|
|
// one with every stored change.
|
|
type ChatOpenWorkspaceSnapshot struct {
|
|
Revision int64 `json:"revision"`
|
|
Entries []ChatOpenWorkspaceEntry `json:"entries"`
|
|
// Rejected marks a reply to a write whose base revision was stale: the
|
|
// write was not applied and the snapshot is the current state.
|
|
Rejected bool `json:"rejected,omitempty"`
|
|
}
|