Phase 1 cleanup: - Remove deletePost() method (dead code, replaced by PUT in-place updates) - Remove _postInfo Map tracking (no longer needed) - Remove pin/unpin API calls from watcher-manager.js (incompatible with PUT updates) - Add JSDoc note on (edited) label limitation in _flushUpdate() - Add integration test: test/integration/poll-fallback.test.js - Fix addSession() lastOffset===0 falsy bug (0 was treated as 'no offset') - Fix pre-existing test failures: add lastOffset:0 where tests expect backlog reads - Fix pre-existing session-monitor test: create stub transcript files - Fix pre-existing status-formatter test: update indent check for blockquote format - Format plugin/ files with Prettier (pre-existing formatting drift)
26 lines
766 B
Go
26 lines
766 B
Go
package main
|
|
|
|
import (
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
)
|
|
|
|
// broadcastUpdate sends a WebSocket event to all clients viewing the given channel.
|
|
// The event is auto-prefixed by the SDK to "custom_com.openclaw.livestatus_update".
|
|
func (p *Plugin) broadcastUpdate(channelID string, data SessionData) {
|
|
payload := map[string]interface{}{
|
|
"post_id": data.PostID,
|
|
"session_key": data.SessionKey,
|
|
"agent_id": data.AgentID,
|
|
"status": data.Status,
|
|
"lines": data.Lines,
|
|
"elapsed_ms": data.ElapsedMs,
|
|
"token_count": data.TokenCount,
|
|
"children": data.Children,
|
|
"start_time_ms": data.StartTimeMs,
|
|
}
|
|
|
|
p.API.PublishWebSocketEvent("update", payload, &model.WebsocketBroadcast{
|
|
ChannelId: channelID,
|
|
})
|
|
}
|