The open source coding agent.
TypeScript
wip: refactoring tui
adamdottv863e7a093ec5
diff --git a/packages/tui/internal/tui/app/app.go b/packages/tui/internal/tui/app/app.goindex ed2a8880644..2e89971f816 100644--- a/packages/tui/internal/tui/app/app.go+++ b/packages/tui/internal/tui/app/app.go@@ -18,6 +18,12 @@ import ()type App struct {+ Paths *struct {+ Config string `json:"config"`+ Cwd string `json:"cwd"`+ Data string `json:"data"`+ Root string `json:"root"`+ }Client *client.ClientWithResponsesEvents *client.ClientProvider *client.ProviderInfo@@ -57,10 +63,13 @@ func New(ctx context.Context) (*App, error) {return nil, err}+ paths, _ := httpClient.PostPathGetWithResponse(context.Background())+// Create service bridgesagentBridge := NewAgentServiceBridge(httpClient)app := &App{+ Paths: paths.JSON200,Client: httpClient,Events: eventClient,Session: &client.SessionInfo{},diff --git a/packages/tui/internal/tui/components/chat/chat.go b/packages/tui/internal/tui/components/chat/chat.goindex ebebac25299..9698d056092 100644--- a/packages/tui/internal/tui/components/chat/chat.go+++ b/packages/tui/internal/tui/components/chat/chat.go@@ -6,7 +6,6 @@ import ("github.com/charmbracelet/lipgloss""github.com/charmbracelet/x/ansi"- "github.com/sst/opencode/internal/config""github.com/sst/opencode/internal/tui/app""github.com/sst/opencode/internal/tui/styles""github.com/sst/opencode/internal/tui/theme"@@ -17,13 +16,13 @@ type SendMsg struct {Attachments []app.Attachment}-func header(width int) string {+func header(app *app.App, width int) string {return lipgloss.JoinVertical(lipgloss.Top,logo(width),repo(width),"",- cwd(width),+ cwd(app, width),)}@@ -121,8 +120,8 @@ func repo(width int) string {Render(repo)}-func cwd(width int) string {- cwd := fmt.Sprintf("cwd: %s", config.WorkingDirectory())+func cwd(app *app.App, width int) string {+ cwd := fmt.Sprintf("cwd: %s", app.Paths.Cwd)t := theme.CurrentTheme()return styles.BaseStyle().diff --git a/packages/tui/internal/tui/components/chat/messages.go b/packages/tui/internal/tui/components/chat/messages.goindex ae6f2a687dc..1def9e37c2f 100644--- a/packages/tui/internal/tui/components/chat/messages.go+++ b/packages/tui/internal/tui/components/chat/messages.go@@ -278,7 +278,7 @@ func (m *messagesCmp) initialScreen() string {return baseStyle.Width(m.width).Render(lipgloss.JoinVertical(lipgloss.Top,- header(m.width),+ header(m.app, m.width),"",lspsConfigured(m.width),),diff --git a/packages/tui/internal/tui/components/chat/sidebar.go b/packages/tui/internal/tui/components/chat/sidebar.goindex d6895a164fd..257b4377336 100644--- a/packages/tui/internal/tui/components/chat/sidebar.go+++ b/packages/tui/internal/tui/components/chat/sidebar.go@@ -71,7 +71,7 @@ func (m *sidebarCmp) View() string {Render(lipgloss.JoinVertical(lipgloss.Top,- header(m.width),+ header(m.app, m.width)," ",m.sessionSection(),shareUrl,