From 6ea2bc052e5b3623b4cedf9b9a9a48ecc7314df0 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Tue, 6 Oct 2026 12:17:19 +0200 Subject: [PATCH] server: add non-blocking state file separate from statewait - state: immediate read of current agent state - statewait: blocks until state changes Clearer semantics than overloading statewait with both behaviors. --- cmd/olliesrv/internal/fs/spec.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/olliesrv/internal/fs/spec.go b/cmd/olliesrv/internal/fs/spec.go index 512f00f..accf1b0 100644 --- a/cmd/olliesrv/internal/fs/spec.go +++ b/cmd/olliesrv/internal/fs/spec.go @@ -877,10 +877,14 @@ func buildAgentChildren(a *agent.Agent, s *session.Session) []virtfs.FsNodeDecl }), virtfs.Stream(a.ChatRead, a.ChatSignal), ), - virtfs.FileNode("statewait", 0444, + virtfs.FileNode("state", 0444, + virtfs.Doc("Current agent state (idle, calling, thinking, paused)"), virtfs.Read(func() ([]byte, error) { return []byte(a.State() + "\n"), nil }), + ), + virtfs.FileNode("statewait", 0444, + virtfs.Doc("Blocks until state changes; returns new value"), virtfs.BlockOnce(func() ([]byte, string, error) { st := a.State() return []byte(st + "\n"), st, nil