webui: add current Agent state to call-status tooltip
diff --git a/loop/agent.go b/loop/agent.go
index cc861ed..9858715 100644
--- a/loop/agent.go
+++ b/loop/agent.go
@@ -105,6 +105,8 @@
 	IsInContainer() bool
 	// FirstMessageIndex returns the index of the first message in the current conversation
 	FirstMessageIndex() int
+
+	CurrentStateName() string
 }
 
 type CodingAgentMessageType string
@@ -333,6 +335,17 @@
 	outstandingToolCalls map[string]string
 }
 
+// Assert that Agent satisfies the CodingAgent interface.
+var _ CodingAgent = &Agent{}
+
+// StateName implements CodingAgent.
+func (a *Agent) CurrentStateName() string {
+	if a.stateMachine == nil {
+		return ""
+	}
+	return a.stateMachine.currentState.String()
+}
+
 func (a *Agent) URL() string { return a.url }
 
 // Title returns the current title of the conversation.
diff --git a/loop/server/loophttp.go b/loop/server/loophttp.go
index 82846ac..f61ed28 100644
--- a/loop/server/loophttp.go
+++ b/loop/server/loophttp.go
@@ -66,13 +66,13 @@
 	SSHError             string               `json:"ssh_error,omitempty"`
 	InContainer          bool                 `json:"in_container"`
 	FirstMessageIndex    int                  `json:"first_message_index"`
-
-	OutsideHostname   string `json:"outside_hostname,omitempty"`
-	InsideHostname    string `json:"inside_hostname,omitempty"`
-	OutsideOS         string `json:"outside_os,omitempty"`
-	InsideOS          string `json:"inside_os,omitempty"`
-	OutsideWorkingDir string `json:"outside_working_dir,omitempty"`
-	InsideWorkingDir  string `json:"inside_working_dir,omitempty"`
+	AgentState           string               `json:"agent_state,omitempty"`
+	OutsideHostname      string               `json:"outside_hostname,omitempty"`
+	InsideHostname       string               `json:"inside_hostname,omitempty"`
+	OutsideOS            string               `json:"outside_os,omitempty"`
+	InsideOS             string               `json:"inside_os,omitempty"`
+	OutsideWorkingDir    string               `json:"outside_working_dir,omitempty"`
+	InsideWorkingDir     string               `json:"inside_working_dir,omitempty"`
 }
 
 type InitRequest struct {
@@ -394,6 +394,7 @@
 			SSHError:             s.sshError,
 			InContainer:          agent.IsInContainer(),
 			FirstMessageIndex:    agent.FirstMessageIndex(),
+			AgentState:           agent.CurrentStateName(),
 		}
 
 		// Create a JSON encoder with indentation for pretty-printing