From bd1e20279725c03c0d7244d1bb4425fe07dac787 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 2 Mar 2026 14:43:42 +0200 Subject: lsp: inject StatusSink to decouple core from tmux package (task 407) --- internal/hexailsp/run.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'internal/hexailsp') diff --git a/internal/hexailsp/run.go b/internal/hexailsp/run.go index 09889ec..ca24016 100644 --- a/internal/hexailsp/run.go +++ b/internal/hexailsp/run.go @@ -18,6 +18,7 @@ import ( "codeberg.org/snonux/hexai/internal/lsp" "codeberg.org/snonux/hexai/internal/runtimeconfig" "codeberg.org/snonux/hexai/internal/stats" + tmx "codeberg.org/snonux/hexai/internal/tmux" ) // ServerRunner is the minimal interface satisfied by lsp.Server. @@ -29,6 +30,17 @@ type ConfigurableServerRunner interface { ApplyOptions(lsp.ServerOptions) } +type tmuxStatusSink struct{} + +func (tmuxStatusSink) SetLLMStart(provider, model string) error { + return tmx.SetStatus(tmx.FormatLLMStartStatus(provider, model)) +} + +func (tmuxStatusSink) SetGlobal(reqs int64, rpm float64, sent int64, recv int64, provider, model string, scopeRPM float64, scopeReqs int64, window time.Duration) error { + status := tmx.FormatGlobalStatusColored(reqs, rpm, sent, recv, provider, model, scopeRPM, scopeReqs, window) + return tmx.SetStatus(status) +} + // ServerFactory creates a ServerRunner. Default uses lsp.NewServer. type ServerFactory func(r io.Reader, w io.Writer, logger *log.Logger, opts lsp.ServerOptions) ServerRunner @@ -150,5 +162,6 @@ func makeServerOptions(cfg appconfig.App, logContext bool, client llm.Client, lo Config: &cfg, Client: client, IgnoreChecker: ignoreChecker, + StatusSink: tmuxStatusSink{}, } } -- cgit v1.2.3