implement nested tool calls and initial setup for result metadata

This commit is contained in:
Kujtim Hoxha
2025-04-12 14:49:01 +02:00
parent 8d874b839d
commit 0697dcc1d9
14 changed files with 585 additions and 168 deletions

View File

@@ -5,6 +5,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/kujtimiihoxha/termai/internal/pubsub"
"github.com/kujtimiihoxha/termai/internal/session"
"github.com/kujtimiihoxha/termai/internal/tui/styles"
)
@@ -19,6 +20,14 @@ func (m *sidebarCmp) Init() tea.Cmd {
}
func (m *sidebarCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case pubsub.Event[session.Session]:
if msg.Type == pubsub.UpdatedEvent {
if m.session.ID == msg.Payload.ID {
m.session = msg.Payload
}
}
}
return m, nil
}
@@ -45,7 +54,7 @@ func (m *sidebarCmp) sessionSection() string {
sessionValue := styles.BaseStyle.
Foreground(styles.Forground).
Width(m.width - lipgloss.Width(sessionKey)).
Render(": New Session")
Render(fmt.Sprintf(": %s", m.session.Title))
return lipgloss.JoinHorizontal(
lipgloss.Left,
sessionKey,