summaryrefslogtreecommitdiff
path: root/internal/hexaicli/run.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-07 21:10:15 +0300
committerPaul Buetow <paul@buetow.org>2025-09-07 21:10:15 +0300
commitb39f233bf65c4a4b1d8d7a813b21d8477699ffae (patch)
tree185069f91a513194545822e60276ab38a2f060c4 /internal/hexaicli/run.go
parentfb15616d595e0bf9f734992ceae529001e1f4677 (diff)
feat(tmux): add status line updates via @hexai_status; wire into CLI, LSP stats, and tmux-action
Diffstat (limited to 'internal/hexaicli/run.go')
-rw-r--r--internal/hexaicli/run.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/internal/hexaicli/run.go b/internal/hexaicli/run.go
index cdcc3ac..18d4289 100644
--- a/internal/hexaicli/run.go
+++ b/internal/hexaicli/run.go
@@ -17,6 +17,7 @@ import (
"codeberg.org/snonux/hexai/internal/logging"
"codeberg.org/snonux/hexai/internal/llm"
"codeberg.org/snonux/hexai/internal/llmutils"
+ "codeberg.org/snonux/hexai/internal/tmux"
)
// Run executes the Hexai CLI behavior given arguments and I/O streams.
@@ -123,8 +124,10 @@ func buildMessagesFromConfig(cfg appconfig.App, input string) []llm.Message {
// runChat executes the chat request, handling streaming and summary output.
func runChat(ctx context.Context, client llm.Client, msgs []llm.Message, input string, out io.Writer, errw io.Writer) error {
- start := time.Now()
- var output string
+ start := time.Now()
+ // Best-effort tmux status update
+ _ = tmux.SetStatus("⏳ " + client.Name() + ":" + client.DefaultModel())
+ var output string
if s, ok := client.(llm.Streamer); ok {
var b strings.Builder
if err := s.ChatStream(ctx, msgs, func(chunk string) {
@@ -142,10 +145,11 @@ func runChat(ctx context.Context, client llm.Client, msgs []llm.Message, input s
output = txt
fmt.Fprint(out, output)
}
- dur := time.Since(start)
- fmt.Fprintf(errw, "\n"+logging.AnsiBase+"done provider=%s model=%s time=%s in_bytes=%d out_bytes=%d"+logging.AnsiReset+"\n",
- client.Name(), client.DefaultModel(), dur.Round(time.Millisecond), len(input), len(output))
- return nil
+ dur := time.Since(start)
+ fmt.Fprintf(errw, "\n"+logging.AnsiBase+"done provider=%s model=%s time=%s in_bytes=%d out_bytes=%d"+logging.AnsiReset+"\n",
+ client.Name(), client.DefaultModel(), dur.Round(time.Millisecond), len(input), len(output))
+ _ = tmux.SetStatus("✅ " + client.DefaultModel() + " " + dur.Round(time.Millisecond).String())
+ return nil
}
// printProviderInfo writes the provider/model line to stderr.