From 231e9ebcc58e16499755b247d0c6c3eb19f7caca Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 17 Apr 2026 13:05:23 +0200 Subject: [PATCH] s/ls, ollie-tmp-path --- internal/p9/server.go | 8 +++++--- internal/p9/sessionstore.go | 5 +++++ main.go | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/p9/server.go b/internal/p9/server.go index 39e6aa2..971e0fe 100644 --- a/internal/p9/server.go +++ b/internal/p9/server.go @@ -609,8 +609,8 @@ func (s *Server) read(cs *connState, fc *plan9.Fcall) *plan9.Fcall { } } - // s/new and s/idx are served from the session store. - if path == "/s/new" || path == "/s/idx" { + // s/new, s/idx, and s/ls are served from the session store. + if path == "/s/new" || path == "/s/idx" || path == "/s/ls" { plog.Debug("Tread path=%q offset=%d count=%d", path, fc.Offset, fc.Count) content, err := s.sessionStore.Get(pathBase(path)) if err != nil { @@ -1503,6 +1503,8 @@ func (s *Server) makeStat(path string) plan9.Dir { default: if path == "/backends" || path == "/help" || path == "/s/idx" { mode = 0444 + } else if path == "/s/ls" { + mode = 0555 } else if path == "/s/new" { mode = 0666 } else if strings.HasPrefix(path, "/a/") { @@ -1592,7 +1594,7 @@ func (s *Server) makeStat(path string) plan9.Dir { // that check stat before reading (cat, 9pfuse, etc.) see non-zero size. if dir.Length == 0 && !isDir { switch { - case path == "/s/new" || path == "/s/idx": + case path == "/s/new" || path == "/s/idx" || path == "/s/ls": if content, err := s.sessionStore.Get(base); err == nil { dir.Length = uint64(len(content)) } diff --git a/internal/p9/sessionstore.go b/internal/p9/sessionstore.go index f34c400..f7425be 100644 --- a/internal/p9/sessionstore.go +++ b/internal/p9/sessionstore.go @@ -17,6 +17,7 @@ func (s *SessionStore) List() ([]os.DirEntry, error) { entries := []os.DirEntry{ syntheticEntry("new", 0666), syntheticEntry("idx", 0444), + syntheticEntry("ls", 0555), } s.srv.mu.RLock() for id := range s.srv.sessions { @@ -32,6 +33,8 @@ func (s *SessionStore) Stat(name string) (os.FileInfo, error) { return &syntheticFileInfo{name: "new", mode: 0666}, nil case "idx": return &syntheticFileInfo{name: "idx", mode: 0444}, nil + case "ls": + return &syntheticFileInfo{name: "ls", mode: 0555}, nil } s.srv.mu.RLock() _, ok := s.srv.sessions[name] @@ -48,6 +51,8 @@ func (s *SessionStore) Get(name string) ([]byte, error) { return []byte("name=\ncwd=\nbackend=\nmodel=\nagent=\n"), nil case "idx": return s.index(), nil + case "ls": + return []byte("#!/usr/bin/env bash\ncat ${OLLIE:-$HOME/mnt/ollie}/s/idx\n"), nil } return nil, fmt.Errorf("%s: not a readable file", name) } diff --git a/main.go b/main.go index 1a4febd..b21f364 100644 --- a/main.go +++ b/main.go @@ -148,7 +148,8 @@ func ensureEnv() { "OLLIE_SKILLS_PATH": filepath.Join(home, ".config", "ollie", "skills"), "OLLIE_PLAN_PATH": filepath.Join(home, ".config", "ollie", "planning"), "OLLIE_MEMORY_PATH": filepath.Join(home, ".config", "ollie", "memory"), - "OLLIE_TMP_PATH": filepath.Join(home, ".local", "share", "ollie", "tmp"), + "OLLIE_TMP_PATH": filepath.Join(home, ".local", "share", "ollie", "tmp"), + "OLLIE_TRANSCRIPT_PATH": filepath.Join(home, ".config", "ollie", "transcript"), } for k, v := range defaults { if os.Getenv(k) == "" {