From 341436a6fda4b31d66ec225f09d701284ea741e9 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 13 Feb 2026 15:05:11 +0100 Subject: [PATCH] feat: add Refresh command to re-detect session state - Expose via Acme tag bar and 9P ctl file - No arg refreshes all sessions, with arg refreshes one --- internal/p9/server.go | 7 ++++++- main.go | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/internal/p9/server.go b/internal/p9/server.go index e4f2000..3b832be 100644 --- a/internal/p9/server.go +++ b/internal/p9/server.go @@ -331,7 +331,7 @@ func (s *Server) write(cs *connState, fc *plan9.Fcall) *plan9.Fcall { } args := strings.Fields(input) if len(args) == 0 { - return errFcall(fc, "usage: stop | kill") + return errFcall(fc, "usage: stop | kill | refresh") } switch args[0] { case "stop": @@ -342,6 +342,11 @@ func (s *Server) write(cs *connState, fc *plan9.Fcall) *plan9.Fcall { case "kill": sess.Close() s.mgr.Remove(sess.ID()) + case "refresh": + ctx := context.Background() + if err := sess.Refresh(ctx); err != nil { + return errFcall(fc, err.Error()) + } default: return errFcall(fc, "unknown command") } diff --git a/main.go b/main.go index 6ff7fad..4212732 100644 --- a/main.go +++ b/main.go @@ -91,7 +91,7 @@ func main() { defer w.CloseFiles() w.Name(windowName) - w.Write("tag", []byte("Get Attach Kill Alias Context Sandbox ")) + w.Write("tag", []byte("Get Attach Kill Refresh Alias Context Sandbox ")) refreshList(w, mgr) w.Ctl("clean") @@ -217,6 +217,23 @@ func main() { srv.OnAliasChange(sess) } refreshList(w, mgr) + case "Refresh": + if arg == "" { + // Refresh all sessions + for _, id := range mgr.List() { + if sess := mgr.Get(id); sess != nil { + sess.Refresh(context.Background()) + } + } + } else { + sess := mgr.Get(arg) + if sess == nil { + fmt.Fprintf(os.Stderr, "Session not found: %s\n", arg) + continue + } + sess.Refresh(context.Background()) + } + refreshList(w, mgr) case "Context": if arg == "" { fmt.Fprintf(os.Stderr, "Usage: Context \n")