Add per-task terminals over WebSocket with an xterm.js Terminal tab

This commit is contained in:
Ian Gulliver
2026-10-15 12:06:50 -07:00
parent 37bf1b60a7
commit ff22f33025
33 changed files with 1600 additions and 167 deletions
+6
View File
@@ -28,6 +28,7 @@ type Server struct {
agents *agents.Manager
notifier *push.Notifier
hub *hub
terminals *terminals
startedAt time.Time
spa fs.FS
@@ -45,6 +46,7 @@ func New(dataDir string, spa fs.FS) (*Server, error) {
s := &Server{
hub: newHub(),
terminals: newTerminals(),
startedAt: time.Now().UTC(),
spa: spa,
users: map[string]string{},
@@ -79,9 +81,13 @@ func (s *Server) publish(ev api.Event) {
s.hub.publish(ev)
s.notifier.Observe(ev)
s.agents.Observe(ev)
if (ev.Kind == "task.merged" || ev.Kind == "task.discarded") && ev.TaskId != nil {
s.terminals.close(*ev.TaskId)
}
}
func (s *Server) Close() error {
s.terminals.closeAll()
s.agents.Close()
s.notifier.Close()
return s.store.Close()