返回 DeepSeek-Reasonix
pending_prompts.go
根目录 / internal / serve / pending_prompts.go
1 package serve
2
3 import (
4 "net/http"
5
6 "reasonix/internal/event"
7 "reasonix/internal/eventwire"
8 )
9
10 // pendingPrompts returns the controller's current approval/ask frames directly.
11 // Unlike the bounded SSE broadcaster, this recovery read cannot drop a frame
12 // when a slow remote subscriber has already fallen behind.
13 func (s *Server) pendingPrompts(w http.ResponseWriter, _ *http.Request) {
14 prompts := make([]eventwire.Event, 0, 1)
15 s.ctl().ReplayPendingPromptsTo(event.FuncSink(func(e event.Event) {
16 prompts = append(prompts, eventwire.ToWire(e))
17 }))
18 writeJSON(w, prompts)
19 }
20
20 lines GO