feat(acp): relay skeleton (subscribe/unsubscribe/fanout/close) + supervisor.GetRelay

This commit is contained in:
2026-05-07 12:16:06 +08:00
parent 839e5c9e95
commit de73ad4935
2 changed files with 201 additions and 1 deletions
+12 -1
View File
@@ -83,6 +83,7 @@ type Process struct {
Stdin io.WriteCloser
Stdout io.ReadCloser
Stderr io.ReadCloser
Relay *Relay
StderrBuf *stderrRing // 排障 ring buffer
StartedAt time.Time
@@ -121,6 +122,16 @@ func (r *stderrRing) Tail(maxBytes int) string {
return out
}
// Relay field + GetRelay method added in Task D7 when Relay type is wired.
// GetRelay returns the relay for an active session, or nil if not running.
// WS handler 用此判断是否进 live 模式。
func (s *Supervisor) GetRelay(sid uuid.UUID) *Relay {
s.mu.RLock()
defer s.mu.RUnlock()
p, ok := s.procs[sid]
if !ok {
return nil
}
return p.Relay
}
// Spawn / Kill / ShutdownAll / monitorProcess / handshake are implemented in subsequent tasks (E2).