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
+16
View File
@@ -62,6 +62,22 @@ func (c *chatSessionChanges) broadcast(sender string, session protocol.ChatSessi
}
}
func (c *chatSessionChanges) broadcastWorkspace(sender string, snapshot protocol.ChatOpenWorkspaceSnapshot) {
c.mu.Lock()
targets := make([]func(protocol.Message) error, 0, len(c.clients))
for id, write := range c.clients {
if id != sender {
targets = append(targets, write)
}
}
c.mu.Unlock()
for _, write := range targets {
copy := snapshot
copy.Entries = append([]protocol.ChatOpenWorkspaceEntry(nil), snapshot.Entries...)
go func() { _ = write(protocol.Message{Type: protocol.ChatOpenWorkspaceChanged, ChatOpenWorkspace: &copy}) }()
}
}
// echoOperatorSession answers a metadata change with the updated registry row
// and pushes the same row to every other connection.
func echoOperatorSession(ctx context.Context, request protocol.Message, sessionID, reply string, registry operatorRegistry, changes *chatSessionChanges, clientID string, write func(protocol.Message) error) {