Skip to content

Commit 842ef3a

Browse files
committed
feat: show queued messages above input
1 parent c9c1352 commit 842ef3a

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

internal/ui/tui/events.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func (m Model) HandleAgentEvent(ev agentcore.Event) (Model, tea.Cmd) {
2424
case agentcore.EventAgentEnd:
2525
m.Running = false
2626
m.ShowSummary = true
27+
m.QueuedMsgs = nil
2728
clear(m.PendingTools)
2829
clear(m.ToolOutputBuf)
2930
if m.AskUser != nil {

internal/ui/tui/model.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ type Model struct {
9797

9898
Tasks *tools.TaskSnapshot // non-nil when tasks exist; displayed above input
9999

100+
QueuedMsgs []string // messages queued while agent is running (display only)
101+
100102
QuitPending bool // true after first Ctrl+C, waiting for second to quit
101103
}
102104

@@ -281,6 +283,10 @@ func (m Model) View() string {
281283
} else {
282284
// Status bar (above input)
283285
parts = append(parts, m.RenderStatusBar())
286+
// Queued messages (sent while agent is running)
287+
if len(m.QueuedMsgs) > 0 {
288+
parts = append(parts, m.renderQueuedMsgs())
289+
}
284290
// Normal: image attachments + input
285291
if len(m.Images) > 0 {
286292
var tags []string
@@ -462,6 +468,7 @@ func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
462468
// Steer only supports text; put images back for next submission.
463469
m.Images = images
464470
m.Driver.Steer(text)
471+
m.QueuedMsgs = append(m.QueuedMsgs, text)
465472
} else if err := m.promptWithImages(text, images); err != nil {
466473
output += "\n" + ErrorStyle.Render(" error: "+err.Error())
467474
}

internal/ui/tui/render.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,17 @@ func (m *Model) renderRunSummary() string {
180180
s.Turns, s.ToolCalls, FormatTokens(s.Input), FormatTokens(s.Output)))
181181
}
182182

183+
// renderQueuedMsgs renders queued messages sent while agent is running.
184+
func (m *Model) renderQueuedMsgs() string {
185+
var b strings.Builder
186+
for _, msg := range m.QueuedMsgs {
187+
text := truncateRunes(msg, 80)
188+
b.WriteString(QueuedMsgStyle.Render(" ↳ " + text))
189+
b.WriteByte('\n')
190+
}
191+
return strings.TrimRight(b.String(), "\n")
192+
}
193+
183194
// renderTaskList renders the task progress bar and task list.
184195
func (m *Model) renderTaskList() string {
185196
snap := m.Tasks

internal/ui/tui/styles.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ var PlanTagStyle = lipgloss.NewStyle().Foreground(ColorAccent)
9595
var (
9696
MutedStyle = lipgloss.NewStyle().Foreground(ColorMuted)
9797

98+
QueuedMsgStyle = lipgloss.NewStyle().Foreground(ColorMuted).Italic(true)
99+
98100
TokenStyle = lipgloss.NewStyle().Foreground(ColorToken)
99101

100102
DiffAddStyle = lipgloss.NewStyle().Foreground(ColorSuccess)

0 commit comments

Comments
 (0)