From b2fe5f1b4e61393f98797d423a42cf138347e3c6 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Sun, 2 Aug 2026 23:35:30 +0200 Subject: [PATCH] connection statuses --- cmd/ollie-9p/main.go | 19 +++++++++++++++---- fs/agentfiles.go | 12 ++++++++++++ kde | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/cmd/ollie-9p/main.go b/cmd/ollie-9p/main.go index 83c1a0d..696f8c2 100644 --- a/cmd/ollie-9p/main.go +++ b/cmd/ollie-9p/main.go @@ -58,10 +58,15 @@ func main() { switch cmd { case "read": - if len(args) != 1 { - fatalf("usage: ollie-9p read path") + openMarker := false + if len(args) == 2 && args[0] == "--open-marker" { + openMarker = true + args = args[1:] } - cmdRead(args[0]) + if len(args) != 1 { + fatalf("usage: ollie-9p read [--open-marker] path") + } + cmdRead(args[0], openMarker) case "write": if len(args) != 1 { fatalf("usage: ollie-9p write path") @@ -164,13 +169,19 @@ func getuser() string { return "none" } -func cmdRead(path string) { +func cmdRead(path string, openMarker bool) { fsys := dial() fid, err := fsys.Open(path, plan9.OREAD) if err != nil { fatalf("open %s: %v", path, err) } defer fid.Close() + // This marker is emitted only after the remote 9P open succeeds. It lets + // connection-aware GUI clients distinguish an opened operation from a + // merely started local helper process. + if openMarker { + fmt.Fprintln(os.Stderr, "OLLIE_9P_OPEN") + } if _, err := io.Copy(os.Stdout, fid); err != nil { fatalf("read %s: %v", path, err) } diff --git a/fs/agentfiles.go b/fs/agentfiles.go index 0d0a765..cd070c7 100644 --- a/fs/agentfiles.go +++ b/fs/agentfiles.go @@ -110,6 +110,18 @@ func listAgents(ctx HandlerCtx) ([]FsNodeDecl, error) { }), ), + // connection — agent execution environment connectivity. Opening this + // file performs a lightweight RPC against the session tool server. + Leaf("connection", 0444, Read(func(_ HandlerCtx) ([]byte, error) { + if s.toolsConn == nil { + return nil, fmt.Errorf("agent tool server unavailable") + } + if _, err := s.toolsConn.ListTools(); err != nil { + return nil, err + } + return []byte("connected\n"), nil + })), + // state — current agent state Leaf("state", 0444, Read(func(_ HandlerCtx) ([]byte, error) { return []byte(a.State() + "\n"), nil diff --git a/kde b/kde index c983e2b..6e7245d 160000 --- a/kde +++ b/kde @@ -1 +1 @@ -Subproject commit c983e2bb6af6769f9dd4b757bf449abbf2f2b066 +Subproject commit 6e7245dd993f7db2f3a0dd51fb77391f9fa72664