diff --git a/gui/main.qml b/gui/main.qml index 742147e..f22fe17 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -11,9 +11,6 @@ ApplicationWindow { font.family: theme.fontFamily || Qt.application.font.family font.pointSize: theme.fontSize > 0 ? theme.fontSize : Qt.application.font.pointSize - // Version counter to force re-evaluation of agent state colors - property int agentStateVersion: 0 - // Apply theme palette to all Qt Quick Controls palette.active.window: theme.windowColor palette.active.windowText: theme.windowTextColor @@ -386,8 +383,14 @@ ApplicationWindow { } } function onAgentStateChanged(sessionId, agentId, state) { - // Increment version to force re-evaluation of all agent state colors - root.agentStateVersion++ + // Update only the specific agent in the model (avoids re-evaluating all) + for (var i = 0; i < sessionTreeModel.count; ++i) { + var item = sessionTreeModel.get(i) + if (item.type === "agent" && item.parentId === sessionId && item.agentId === agentId) { + sessionTreeModel.setProperty(i, "state", state) + break + } + } } } @@ -979,10 +982,7 @@ ApplicationWindow { Layout.preferredHeight: 8 Layout.alignment: Qt.AlignVCenter radius: 4 - property int stateVersion: root.agentStateVersion color: { - // Depend on stateVersion to force re-evaluation - void(stateVersion) if (type === "session") { // Session: RPC connection health var cc = connectionColor || "gray" @@ -991,11 +991,8 @@ ApplicationWindow { if (cc === "red") return "#f44336" return "#9e9e9e" } - // Agent: check if parent session is paused - if (ollie.isSessionPaused(parentId)) - return "#9e9e9e" // gray when paused - // Agent: execution state - query live state - var s = ollie.agentState(parentId, agentId) || "idle" + // Agent: use state from model (already updated via onAgentStateChanged) + var s = model.state || "idle" if (s === "idle") return "#4caf50" if (s.startsWith("calling")) return "#ff9800" return "#2196f3"