Make terminal log stream live-only by default

This commit is contained in:
npc0-hue
2026-08-25 09:42:24 +08:00
parent 199fa8b41d
commit 725b71b6b6
7 changed files with 72 additions and 9 deletions
+6 -2
View File
@@ -15,13 +15,14 @@ import (
)
const (
defaultLogEventHistoryLimit = 100
defaultLogEventHistoryLimit = 0
maxLogEventHistoryLimit = 10000
logEventHeartbeatInterval = 15 * time.Second
managedLogSessionIDPrefix = "log-session:"
)
// serverLogEvents streams platform-accepted server log history and live append events for the terminal drawer.
// serverLogEvents streams platform-accepted live append events for the terminal drawer.
// Callers can opt into a bounded current-session replay with historyLimit.
func (h *coreHandlers) serverLogEvents(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
writeMethodNotAllowed(w, http.MethodGet)
@@ -221,6 +222,9 @@ func (h *coreHandlers) writeCurrentLogSession(w http.ResponseWriter, serverInsta
return nil, err
}
for _, stream := range active.streams {
if historyLimit == 0 {
emittedThrough[stream.ID] = stream.LatestSeq
}
if err := writeSSEJSON(w, "stream", "", dto.LogStreamFromDomain(stream)); err != nil {
return nil, err
}