Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/app/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,20 @@ func (app *ChatApplication) handleA2ATaskManagementCancelled(cmds []tea.Cmd) []t
}

app.focusedComponent = app.inputView

if app.backgroundTaskService != nil {
backgroundTasks := app.backgroundTaskService.GetBackgroundTasks()
if len(backgroundTasks) > 0 {
cmds = append(cmds, func() tea.Msg {
return domain.SetStatusEvent{
Message: fmt.Sprintf("Background tasks running (%d)", len(backgroundTasks)),
Spinner: true,
StatusType: domain.StatusDefault,
}
})
}
}

return cmds
}

Expand Down
8 changes: 7 additions & 1 deletion internal/handlers/chat_shortcut_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,15 @@ func (s *ChatShortcutHandler) handleShowA2ATaskManagementSideEffect() tea.Msg {
}
}

hasBackgroundTasks := false
if s.handler.backgroundTaskService != nil {
backgroundTasks := s.handler.backgroundTaskService.GetBackgroundTasks()
hasBackgroundTasks = len(backgroundTasks) > 0
}

return domain.SetStatusEvent{
Message: "Task management interface",
Spinner: false,
Spinner: hasBackgroundTasks,
TokenUsage: s.handler.getCurrentTokenUsage(),
StatusType: domain.StatusDefault,
}
Expand Down
4 changes: 0 additions & 4 deletions internal/ui/components/conversation_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
func TestNewConversationView(t *testing.T) {
cv := NewConversationView(nil)

if cv == nil {
t.Fatal("Expected ConversationView to be created, got nil")
}

if cv.width != 80 {
t.Errorf("Expected default width 80, got %d", cv.width)
}
Expand Down
4 changes: 0 additions & 4 deletions internal/ui/components/help_bar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import (
func TestNewHelpBar(t *testing.T) {
hb := NewHelpBar(nil)

if hb == nil {
t.Fatal("Expected HelpBar to be created, got nil")
}

if hb.width != 80 {
t.Errorf("Expected default width 80, got %d", hb.width)
}
Expand Down
4 changes: 0 additions & 4 deletions internal/ui/components/input_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ func TestNewInputView(t *testing.T) {
mockModelService := &mockModelService{}
iv := NewInputView(mockModelService)

if iv == nil {
t.Fatal("Expected InputView to be created, got nil")
}

if iv.text != "" {
t.Errorf("Expected empty text, got '%s'", iv.text)
}
Expand Down
4 changes: 0 additions & 4 deletions internal/ui/components/status_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
func TestNewStatusView(t *testing.T) {
sv := NewStatusView(nil)

if sv == nil {
t.Fatal("Expected StatusView to be created, got nil")
}

if sv.width != 0 {
t.Errorf("Expected default width 0, got %d", sv.width)
}
Expand Down
40 changes: 17 additions & 23 deletions internal/ui/keybinding/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,14 @@ func TestKeyResolution(t *testing.T) {
action := registry.Resolve("ctrl+c", mockContext)
if action == nil {
t.Fatal("Expected ctrl+c to resolve to an action")
}
if action.ID != "quit" {
} else if action.ID != "quit" {
t.Errorf("Expected ctrl+c to resolve to 'quit', got %s", action.ID)
}

action = registry.Resolve("ctrl+r", mockContext)
if action == nil {
t.Fatal("Expected ctrl+r to resolve to an action")
}
if action.ID != "toggle_tool_expansion" {
} else if action.ID != "toggle_tool_expansion" {
t.Errorf("Expected ctrl+r to resolve to 'toggle_tool_expansion', got %s", action.ID)
}

Expand Down Expand Up @@ -330,23 +328,23 @@ func TestActionHandlers(t *testing.T) {
action := registry.Resolve("ctrl+c", mockContext)
if action == nil {
t.Fatal("Expected ctrl+c to resolve to quit action")
}

cmd := action.Handler(mockContext, tea.KeyMsg{})
if cmd == nil {
t.Error("Expected quit handler to return a command")
} else {
cmd := action.Handler(mockContext, tea.KeyMsg{})
if cmd == nil {
t.Error("Expected quit handler to return a command")
}
}

action = registry.Resolve("ctrl+r", mockContext)
if action == nil {
t.Fatal("Expected ctrl+r to resolve to toggle action")
}
} else {
initialCallCount := mockContext.expandToggleCalls
_ = action.Handler(mockContext, tea.KeyMsg{})

initialCallCount := mockContext.expandToggleCalls
_ = action.Handler(mockContext, tea.KeyMsg{})

if mockContext.expandToggleCalls != initialCallCount+1 {
t.Error("Expected toggle handler to call ToggleToolResultExpansion()")
if mockContext.expandToggleCalls != initialCallCount+1 {
t.Error("Expected toggle handler to call ToggleToolResultExpansion()")
}
}
}

Expand Down Expand Up @@ -391,8 +389,7 @@ func TestConditionalKeyBindings(t *testing.T) {
action := registry.Resolve("enter", emptyInputContext)
if action == nil {
t.Fatal("Expected enter key to resolve to enter_key_handler even when input is empty")
}
if action.ID != "enter_key_handler" {
} else if action.ID != "enter_key_handler" {
t.Errorf("Expected enter to resolve to 'enter_key_handler', got %s", action.ID)
}

Expand All @@ -403,8 +400,7 @@ func TestConditionalKeyBindings(t *testing.T) {
action = registry.Resolve("enter", nonEmptyInputContext)
if action == nil {
t.Fatal("Expected enter key to resolve to enter_key_handler when input has content")
}
if action.ID != "enter_key_handler" {
} else if action.ID != "enter_key_handler" {
t.Errorf("Expected enter to resolve to 'enter_key_handler', got %s", action.ID)
}
}
Expand Down Expand Up @@ -451,8 +447,7 @@ func TestActionRegistration(t *testing.T) {
retrievedAction := registry.GetAction("test_action")
if retrievedAction == nil {
t.Fatal("Expected to retrieve registered action")
}
if retrievedAction.ID != "test_action" {
} else if retrievedAction.ID != "test_action" {
t.Errorf("Expected retrieved action ID to be 'test_action', got %s", retrievedAction.ID)
}

Expand All @@ -462,8 +457,7 @@ func TestActionRegistration(t *testing.T) {
resolvedAction := registry.Resolve("ctrl+t", mockContext)
if resolvedAction == nil {
t.Fatal("Expected custom action to be resolved")
}
if resolvedAction.ID != "test_action" {
} else if resolvedAction.ID != "test_action" {
t.Errorf("Expected resolved action to be 'test_action', got %s", resolvedAction.ID)
}
}
Expand Down