app

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CONVERSATION_LIST_COUNT = 250

Variables

This section is empty.

Functions

This section is empty.

Types

type MsgAgentSet

type MsgAgentSet struct {
	Agent *api.Agent
}

MsgAgentSet is sent when the agent is set

type MsgCompletionLoopDone

type MsgCompletionLoopDone struct{}

MsgCompletionLoopDone is sent when the completion step has finished

type MsgConversationDeleted

type MsgConversationDeleted struct {
	ConversationID uint
}

MsgConversationDeleted is sent when a conversation is deleted

type MsgConversationListLoaded

type MsgConversationListLoaded struct {
	Conversations conversation.ConversationList
}

MsgConversationListLoaded is sent when the conversation list is loaded

type MsgConversationLoaded

type MsgConversationLoaded struct {
	Thread            *conversation.Thread
	SelectionBehavior SelectionBehavior
}

MsgConversationLoaded is sent when a conversation is loaded

type MsgConversationPersisted

type MsgConversationPersisted struct {
	Next tea.Cmd
}

MsgConversationPersisted is sent when conversation is persisted

type MsgConversationSearchResults

type MsgConversationSearchResults struct {
	Conversations conversation.ConversationList
	Query         string
}

MsgConversationSearchResults is sent when conversation search completes

type MsgMessageAdded

type MsgMessageAdded struct {
	Message conversation.Message
	Index   int
}

MsgMessageAdded is sent when a message is added

type MsgMessageUpdated

type MsgMessageUpdated struct {
	Message conversation.Message
	Index   int
}

MsgMessageUpdated is sent when a message is updated

type MsgModelSet

type MsgModelSet struct {
	Model *api.Model
}

MsgModelSet is sent when the model is set

type MsgResponseChunk

type MsgResponseChunk struct {
	Kind         api.ChunkKind
	Text         string
	TokenCount   uint
	NextEventCmd tea.Cmd
}

MsgResponseChunk is sent for each response chunk

type MsgResponseCompleted

type MsgResponseCompleted struct {
	Message      *api.Message
	NextEventCmd tea.Cmd
}

MsgResponseCompleted is sent when response is complete

type MsgResponseStopped

type MsgResponseStopped struct{}

MsgResponseStopped is sent when response is stopped by the user

type MsgTitleGenerated

type MsgTitleGenerated struct {
	Title string
}

MsgTitleGenerated is sent when title is generated

type MsgToolsConfirmed added in v0.6.0

type MsgToolsConfirmed struct {
	AllRejected bool
}

MsgToolsConfirmed is sent when tool execution completes successfully

type SelectionBehavior

type SelectionBehavior int

SelectionBehavior controls where the selected message lands after a conversation load

const (
	SelectionEnd   SelectionBehavior = iota // jump to the last message
	SelectionStart                          // jump to the first message
	SelectionKeep                           // keep the current selected index
)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(state *TUI) *Service

func (*Service) BranchMessage

func (s *Service) BranchMessage(index int, content string) tea.Cmd

BranchMessage creates a new message with the given content branching off from the same parent as the message at index, without copying descendants. The new message is set as the selected path. Used when editing a message that already has replies.

func (*Service) ConfirmTools added in v0.6.0

func (s *Service) ConfirmTools(confirmations []api.ToolConfirmation) tea.Cmd

ConfirmTools executes the tool calls in the last message using the given confirmations and appends results to the thread. Runs asynchronously; emits MsgToolsConfirmed on success or MsgError on failure.

func (*Service) CycleSelection

func (s *Service) CycleSelection(message *conversation.Message, forward bool, isRoot bool) tea.Cmd

func (*Service) DeleteConversation

func (s *Service) DeleteConversation(id uint) tea.Cmd

func (*Service) DeleteMessage

func (s *Service) DeleteMessage(index int, withDescendants bool) tea.Cmd

func (*Service) GenerateTitle

func (s *Service) GenerateTitle() tea.Cmd

func (*Service) LoadConversation

func (s *Service) LoadConversation(id uint, selectBehavior SelectionBehavior) tea.Cmd

func (*Service) LoadConversationList

func (s *Service) LoadConversationList() tea.Cmd

func (*Service) LoadThread

func (s *Service) LoadThread(id uint) (*conversation.Thread, error)

LoadThread fetches a conversation by ID, loads its message thread, and restores the saved agent and workspace. Shared by the sync initial-load path and the async Service.LoadConversation.

func (*Service) NewConversation

func (s *Service) NewConversation() tea.Cmd

func (*Service) PersistConversation

func (s *Service) PersistConversation(next tea.Cmd) tea.Cmd

func (*Service) PersistTitle

func (s *Service) PersistTitle() tea.Cmd

PersistTitle saves only the conversation metadata (e.g. title) to the repo without re-persisting messages. Used after title generation.

func (*Service) SearchConversations

func (s *Service) SearchConversations(query string) tea.Cmd

func (*Service) SendMessage

func (s *Service) SendMessage(parts []api.ContentPart) tea.Cmd

func (*Service) SetAgent

func (s *Service) SetAgent(agent *api.Agent) tea.Cmd

func (*Service) SetModel

func (s *Service) SetModel(model *api.Model) tea.Cmd

func (*Service) StartCompletionStep added in v0.6.0

func (s *Service) StartCompletionStep() tea.Cmd

StartCompletionStep configures the thread and starts a single completion step. Events are emitted as tea.Msg values via the returned command chain.

func (*Service) StopResponse

func (s *Service) StopResponse() tea.Cmd

func (*Service) UpdateMessage

func (s *Service) UpdateMessage(index int, content string) tea.Cmd

type Session

type Session struct {
	Model       *api.Model
	Agent       *api.Agent
	Effort      api.ReasoningEffort
	Temperature float32
	MaxTokens   int

	// Non-nil when explicitly provided by the user (e.g. via CLI flags).
	// When switching models, these values are kept instead of adopting
	// the new model's defaults.
	TemperatureOverride *float32
	MaxTokensOverride   *int
}

Session holds the active model and agent configuration.

type TUI

type TUI struct {
	Ctx           *lmcli.Context
	Service       Service
	Conversations conversation.ConversationList
	Thread        *conversation.Thread
	Session       Session

	// InitialMessage is an optional message to send immediately when the
	// chat view opens. Cleared after being consumed.
	InitialMessage string
}

func New

func New(ctx *lmcli.Context, initialConversation *conversation.Conversation, temperatureOverride *float32, maxTokensOverride *int) *TUI

func (*TUI) ActiveModel

func (s *TUI) ActiveModel(style lipgloss.Style) string

func (*TUI) HandleMessageDelete

func (s *TUI) HandleMessageDelete(msgId uint)

func (*TUI) SetAgent

func (s *TUI) SetAgent(agent *api.Agent)

func (*TUI) SetModel

func (s *TUI) SetModel(model *api.Model)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL