@@ -4,6 +4,7 @@ import (
6 "math/rand"
6 "math/rand"
@@ -72,6 +73,14 @@ type appModel struct {
73 // Chat Page Specific
74 // Chat Page Specific
74 selectedSessionID string // The ID of the currently selected session
75 selectedSessionID string // The ID of the currently selected session
77+ // sendProgressBar instructs the TUI to send progress bar updates to the
81+ // QueryVersion instructs the TUI to query for the terminal version when it
77// Init initializes the application model and returns initial commands.
86// Init initializes the application model and returns initial commands.
@@ -88,6 +97,9 @@ func (a appModel) Init() tea.Cmd {
89 cmd = a.status.Init()
98 cmd = a.status.Init()
90 cmds = append(cmds, cmd)
99 cmds = append(cmds, cmd)
101+ cmds = append(cmds, tea.RequestTerminalVersion)
92 return tea.Batch(cmds...)
104 return tea.Batch(cmds...)
@@ -99,6 +111,18 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
99 a.isConfigured = config.HasInitialDataConfig()
111 a.isConfigured = config.HasInitialDataConfig()
101 switch msg := msg.(type) {
113 switch msg := msg.(type) {
115+ // Is this Windows Terminal?
116+ if !a.sendProgressBar {
117+ a.sendProgressBar = slices.Contains(msg, "WT_SESSION")
119+ case tea.TerminalVersionMsg:
120+ termVersion := strings.ToLower(string(msg))
121+ // Only enable progress bar for the following terminals.
122+ if !a.sendProgressBar {
123+ a.sendProgressBar = strings.Contains(termVersion, "ghostty")
102 case tea.KeyboardEnhancementsMsg:
126 case tea.KeyboardEnhancementsMsg:
103 for id, page := range a.pages {
127 for id, page := range a.pages {
104 m, pageCmd := page.Update(msg)
128 m, pageCmd := page.Update(msg)
@@ -555,7 +579,7 @@ func (a *appModel) View() tea.View {
555 view.MouseMode = tea.MouseModeCellMotion
579 view.MouseMode = tea.MouseModeCellMotion
556 view.AltScreen = true
580 view.AltScreen = true
558− if a.app != nil && a.app.AgentCoordinator != nil && a.app.AgentCoordinator.IsBusy() {
582+ if a.sendProgressBar && a.app != nil && a.app.AgentCoordinator != nil && a.app.AgentCoordinator.IsBusy() {
559 // HACK: use a random percentage to prevent ghostty from hiding it
583 // HACK: use a random percentage to prevent ghostty from hiding it
560 // after a timeout.
584 // after a timeout.
561 view.ProgressBar = tea.NewProgressBar(tea.ProgressBarIndeterminate, rand.Intn(100))
585 view.ProgressBar = tea.NewProgressBar(tea.ProgressBarIndeterminate, rand.Intn(100))
@@ -564,7 +588,7 @@ func (a *appModel) View() tea.View {
566// New creates and initializes a new TUI application model.
590// New creates and initializes a new TUI application model.
567−func New(app *app.App) tea.Model {
591+func New(app *app.App) *appModel {
568 chatPage := chat.New(app)
592 chatPage := chat.New(app)
569 keyMap := DefaultKeyMap()
593 keyMap := DefaultKeyMap()
570 keyMap.pageBindings = chatPage.Bindings()
594 keyMap.pageBindings = chatPage.Bindings()