Show connected clients and their last human action in Status

This commit is contained in:
Ian Gulliver
2026-10-17 23:24:26 -07:00
parent 28c4549151
commit 8d9ba10849
8 changed files with 332 additions and 246 deletions
+3 -2
View File
@@ -232,7 +232,7 @@ func (s *Server) GetTaskTerminal(w http.ResponseWriter, r *http.Request, taskID
defer cancel()
go func() {
defer cancel()
terminalInput(ctx, conn, term)
terminalInput(ctx, conn, term, func() { s.acted(actor(r), r) })
}()
if len(backlog) > 0 {
@@ -264,13 +264,14 @@ func (s *Server) GetTaskTerminal(w http.ResponseWriter, r *http.Request, taskID
}
}
func terminalInput(ctx context.Context, conn *websocket.Conn, term *terminal) {
func terminalInput(ctx context.Context, conn *websocket.Conn, term *terminal, acted func()) {
for {
typ, b, err := conn.Read(ctx)
if err != nil {
return
}
if typ == websocket.MessageBinary {
acted()
_, err = term.ptmx.Write(b)
if err != nil {
slog.Debug("terminal input", "err", err)