From 9929abc73b42f632566fe1e81eb42842d13faa63 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Tue, 4 Aug 2026 16:24:57 +0200 Subject: [PATCH] gui: use Connections to update agent state on revision change --- gui/main.qml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gui/main.qml b/gui/main.qml index 6d631ba..be59a29 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -1125,6 +1125,17 @@ ApplicationWindow { Layout.alignment: Qt.AlignVCenter radius: 4 visible: type !== "header" + property string currentState: type === "agent" ? ollie.agentState(parentId, agentId) : "" + + Connections { + target: ollie + function onAgentStateRevisionChanged() { + if (type === "agent") { + stateDot.currentState = ollie.agentState(parentId, agentId) + } + } + } + color: { if (type === "session") { var cc = connectionColor || "gray" @@ -1133,13 +1144,10 @@ ApplicationWindow { if (cc === "red") return "#f44336" return "#9e9e9e" } - // Agent: gray if paused, else state color from map - // Revision forces re-eval when any state changes - var rev = ollie.agentStateRevision + // Agent: gray if paused, else state color if (ollie.isSessionPaused(parentId)) return "#9e9e9e" - var s = rev >= 0 ? ollie.agentState(parentId, agentId) : "idle" - if (s === "idle") return "#4caf50" - if (s.startsWith("calling")) return "#ff9800" + if (currentState === "idle") return "#4caf50" + if (currentState.startsWith("calling")) return "#ff9800" return "#2196f3" } }