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"` }