Sync open chats across devices through the server (pipeline run work in progress)

This commit is contained in:
2026-11-12 02:59:34 +00:00
parent 2330f50268
commit c48a1559ac
21 changed files with 703 additions and 31 deletions
+4
View File
@@ -81,6 +81,10 @@ const (
// 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"
// ChatOpenWorkspace replaces the bounded, server-authoritative ordered set
// of open operator chats. The reply and push carry the complete snapshot.
ChatOpenWorkspace = "chat_open_workspace"
ChatOpenWorkspaceChanged = "chat_open_workspace_changed"
// 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.
+20
View File
@@ -0,0 +1,20 @@
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"`
}
type ChatOpenWorkspaceRequest struct {
Entries []ChatOpenWorkspaceEntry `json:"entries"`
// Seed is honored only when the server has no saved workspace yet. It makes
// migration from the old device-local snapshot race-safe.
Seed bool `json:"seed,omitempty"`
}
type ChatOpenWorkspaceSnapshot struct {
Revision int64 `json:"revision"`
Entries []ChatOpenWorkspaceEntry `json:"entries"`
}
+13 -11
View File
@@ -200,17 +200,19 @@ type Message struct {
SearchResults *SearchResponse `json:"search_results,omitempty"`
// Chat is the brokered OpenCode chat traffic (route B). See chat.go for the
// per-type payload structs and the wire shapes they mirror.
ChatSessions []ChatSession `json:"chat_sessions,omitempty"`
ChatSession *ChatSession `json:"chat_session,omitempty"`
ChatCreate *ChatCreateRequest `json:"chat_create,omitempty"`
ChatAdopt *ChatAdoptRequest `json:"chat_adopt,omitempty"`
ChatQuery *ChatQuery `json:"chat_query,omitempty"`
ChatPrompt *ChatPromptRequest `json:"chat_prompt,omitempty"`
ChatMessages []ChatMessage `json:"chat_messages,omitempty"`
ChatHistory *ChatHistoryPage `json:"chat_history,omitempty"`
ChatEvent *ChatEventFrame `json:"chat_event,omitempty"`
ChatPermission *ChatPermissionFrame `json:"chat_permission,omitempty"`
ChatReply *ChatReplyRequest `json:"chat_reply,omitempty"`
ChatSessions []ChatSession `json:"chat_sessions,omitempty"`
ChatSession *ChatSession `json:"chat_session,omitempty"`
ChatOpenWorkspaceRequest *ChatOpenWorkspaceRequest `json:"chat_open_workspace_request,omitempty"`
ChatOpenWorkspace *ChatOpenWorkspaceSnapshot `json:"chat_open_workspace,omitempty"`
ChatCreate *ChatCreateRequest `json:"chat_create,omitempty"`
ChatAdopt *ChatAdoptRequest `json:"chat_adopt,omitempty"`
ChatQuery *ChatQuery `json:"chat_query,omitempty"`
ChatPrompt *ChatPromptRequest `json:"chat_prompt,omitempty"`
ChatMessages []ChatMessage `json:"chat_messages,omitempty"`
ChatHistory *ChatHistoryPage `json:"chat_history,omitempty"`
ChatEvent *ChatEventFrame `json:"chat_event,omitempty"`
ChatPermission *ChatPermissionFrame `json:"chat_permission,omitempty"`
ChatReply *ChatReplyRequest `json:"chat_reply,omitempty"`
// ChatClose carries the outcome of a chat_close; the close and reopen
// requests themselves ride on ChatQuery (the session id), matching
// chat_messages/chat_interrupt.