Display branch name alongside title in termui and webui
This change adds the branch name alongside the title in both the terminal UI and the web UI, following up on commit a9b3822fd2cfdc035e7daa8b59496f9838a4b2c6 which added the branch_name parameter to the title tool.
Co-Authored-By: sketch <hello@sketch.dev>
diff --git a/loop/agent.go b/loop/agent.go
index 9b391d0..a130c96 100644
--- a/loop/agent.go
+++ b/loop/agent.go
@@ -74,6 +74,9 @@
// Title returns the current title of the conversation.
Title() string
+ // BranchName returns the git branch name for the conversation.
+ BranchName() string
+
// OS returns the operating system of the client.
OS() string
@@ -321,6 +324,13 @@
return a.title
}
+// BranchName returns the git branch name for the conversation.
+func (a *Agent) BranchName() string {
+ a.mu.Lock()
+ defer a.mu.Unlock()
+ return a.branchName
+}
+
// OutstandingLLMCallCount returns the number of outstanding LLM calls.
func (a *Agent) OutstandingLLMCallCount() int {
a.mu.Lock()
diff --git a/loop/server/loophttp.go b/loop/server/loophttp.go
index b0aa65e..8df1fc4 100644
--- a/loop/server/loophttp.go
+++ b/loop/server/loophttp.go
@@ -54,6 +54,7 @@
TotalUsage *ant.CumulativeUsage `json:"total_usage,omitempty"`
InitialCommit string `json:"initial_commit"`
Title string `json:"title"`
+ BranchName string `json:"branch_name,omitempty"`
Hostname string `json:"hostname"` // deprecated
WorkingDir string `json:"working_dir"` // deprecated
OS string `json:"os"` // deprecated
@@ -373,6 +374,7 @@
WorkingDir: getWorkingDir(),
InitialCommit: agent.InitialCommit(),
Title: agent.Title(),
+ BranchName: agent.BranchName(),
OS: agent.OS(),
OutsideHostname: agent.OutsideHostname(),
InsideHostname: s.hostname,