Remove redundant Refresh command from Acme interface

Get command now simply reads from agent/list since anvilsrv
handles session state management. Removed client-side PID
checking and refresh logic.
This commit is contained in:
Levi Neely 2026-02-15 11:47:11 +01:00
parent e88d91c78d
commit ab5f9705cd
2 changed files with 3 additions and 36 deletions

View File

@ -205,7 +205,7 @@ Type `Assist` in Acme and middle-click to open the `/AnviLLM/` session manager.
### Commands
**Main window** (`/AnviLLM/`) tag: `Get Attach Stop Restart Kill Refresh Alias Context Daemon Sandbox`
**Main window** (`/AnviLLM/`) tag: `Get Attach Stop Restart Kill Alias Context Daemon Sandbox`
| Command | Description |
|---------|-------------|
@ -214,7 +214,6 @@ Type `Assist` in Acme and middle-click to open the `/AnviLLM/` session manager.
| `Stop <id>` | Stop session (preserves tmux) |
| `Restart <id>` | Restart stopped session |
| `Kill <id>` | Terminate session |
| `Refresh <id>` | Re-detect session state |
| `Attach <id>` | Open tmux terminal |
| `Alias <id> <name>` | Name a session |
| `Context <id>` | Edit context (prepended to prompts) |
@ -240,7 +239,7 @@ agent/
└── <id>/
├── in # Write prompts
├── out # Read responses
├── ctl # "stop", "restart", "kill", "refresh"
├── ctl # "stop", "restart", "kill"
├── state # starting, idle, running, stopped, error, exited
├── context # Prepended to prompts (r/w)
├── alias # Session name (r/w)

View File

@ -12,7 +12,6 @@ import (
"regexp"
"strings"
"sync"
"syscall"
"time"
"9fans.net/go/acme"
@ -93,7 +92,7 @@ func main() {
defer w.CloseFiles()
w.Name(windowName)
w.Write("tag", []byte("Get Attach Stop Restart Kill Refresh Alias Context Daemon Sandbox "))
w.Write("tag", []byte("Get Attach Stop Restart Kill Alias Context Daemon Sandbox "))
refreshList(w)
w.Ctl("clean")
@ -209,20 +208,6 @@ func main() {
}
}
refreshList(w)
case "Refresh":
if arg == "" {
// Refresh all sessions
sessions, _ := listSessions()
for _, sess := range sessions {
controlSession(sess.ID, "refresh")
}
} else {
if err := controlSession(arg, "refresh"); err != nil {
fmt.Fprintf(os.Stderr, "Failed to refresh session: %v\n", err)
continue
}
}
refreshList(w)
case "Context":
if arg == "" {
fmt.Fprintf(os.Stderr, "Usage: Context <session-id>\n")
@ -527,23 +512,6 @@ func refreshList(w *acme.Win) {
buf.WriteString(fmt.Sprintf("%-5s %-10s %-9s %-16s %s\n", "-----", "----------", "---------", "----------------", strings.Repeat("-", 40)))
for _, sess := range sessions {
// Check if PID is alive (server handles this via Refresh)
if sess.Pid != 0 {
if err := syscall.Kill(sess.Pid, 0); err != nil {
// Only refresh if process doesn't exist (ESRCH)
// Ignore permission errors (EPERM) - process exists but we can't signal it
if err == syscall.ESRCH {
// Process died, trigger refresh
fmt.Fprintf(os.Stderr, "Warning: session %s PID %d died, refreshing\n", sess.ID, sess.Pid)
controlSession(sess.ID, "refresh")
// Re-read session info
if updated, err := getSession(sess.ID); err == nil {
sess = updated
}
}
}
}
alias := sess.Alias
if alias == "" {
alias = "-"