1package model
2
3import (
4 "charm.land/lipgloss/v2"
5 "github.com/charmbracelet/crush/internal/agent"
6 "github.com/charmbracelet/crush/internal/ui/common"
7 uv "github.com/charmbracelet/ultraviolet"
8)
9
10// selectedLargeModel returns the currently selected large language model from
11// the agent coordinator, if one exists.
12func (m *UI) selectedLargeModel() *agent.Model {
13 if m.com.App.AgentCoordinator != nil {
14 model := m.com.App.AgentCoordinator.Model()
15 return &model
16 }
17 return nil
18}
19
20// landingView renders the landing page view showing the current working
21// directory, model information, and LSP/MCP status in a two-column layout.
22func (m *UI) landingView() string {
23 t := m.com.Styles
24 width := m.layout.main.Dx()
25 cwd := common.PrettyPath(t, m.com.Config().WorkingDir(), width)
26
27 parts := []string{
28 cwd,
29 }
30
31 parts = append(parts, "", m.modelInfo(width))
32 infoSection := lipgloss.JoinVertical(lipgloss.Left, parts...)
33
34 _, remainingHeightArea := uv.SplitVertical(m.layout.main, uv.Fixed(lipgloss.Height(infoSection)+1))
35
36 mcpLspSectionWidth := min(30, (width-1)/2)
37
38 lspSection := m.lspInfo(mcpLspSectionWidth, max(1, remainingHeightArea.Dy()), false)
39 mcpSection := m.mcpInfo(mcpLspSectionWidth, max(1, remainingHeightArea.Dy()), false)
40
41 content := lipgloss.JoinHorizontal(lipgloss.Left, lspSection, " ", mcpSection)
42
43 return lipgloss.NewStyle().
44 Width(width).
45 Height(m.layout.main.Dy() - 1).
46 PaddingTop(1).
47 Render(
48 lipgloss.JoinVertical(lipgloss.Left, infoSection, "", content),
49 )
50}