tui

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ASCIIArt = `` /* 1004-byte string literal not displayed */

ASCIIArt is the polycode logo for use in splash screens and CLI output.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigChangedMsg

type ConfigChangedMsg struct {
	Config *config.Config
}

ConfigChangedMsg is sent when the config has been modified by the settings screens. The app layer handles this by rebuilding the registry and pipeline.

type ConfirmActionMsg

type ConfirmActionMsg struct {
	Description string
	ResponseCh  chan bool
}

ConfirmActionMsg asks the user to confirm an action. The ResponseCh is used to synchronously communicate the user's decision back to the goroutine that requested confirmation.

type ConsensusAnalysisMsg added in v0.2.0

type ConsensusAnalysisMsg struct {
	Confidence string
	Agreements []string
	Minorities []string
	Evidence   []string
}

ConsensusAnalysisMsg delivers structured provenance from the consensus synthesis.

type ConsensusChunkMsg

type ConsensusChunkMsg struct {
	Delta string
	Done  bool
	Error error
}

ConsensusChunkMsg delivers a streaming chunk from the consensus synthesis.

type Exchange

type Exchange struct {
	Prompt             string
	ConsensusResponse  string
	IndividualResponse map[string]string // provider name → response
}

Exchange represents a completed prompt/response pair in history.

type MemoryDisplayMsg added in v0.2.0

type MemoryDisplayMsg struct {
	Content string
}

MemoryDisplayMsg shows memory contents in the chat.

type ModeChangedMsg added in v0.2.0

type ModeChangedMsg struct {
	Mode string // "quick", "balanced", "thorough"
}

ModeChangedMsg updates the current operating mode display.

type Model

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

Model is the main Bubble Tea model for the polycode TUI.

func NewModel

func NewModel(providerNames []string, primaryName string, version string) Model

NewModel creates a new TUI model.

func (*Model) AppendHistory added in v0.2.0

func (m *Model) AppendHistory(ex Exchange)

AppendHistory adds an exchange to the display history (used for session restore).

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (Model) SendConsensusChunk

func (m Model) SendConsensusChunk(delta string, done bool, err error) tea.Cmd

func (Model) SendProviderChunk

func (m Model) SendProviderChunk(name, delta string, done bool, err error) tea.Cmd

func (*Model) SetClearHandler added in v0.2.0

func (m *Model) SetClearHandler(handler func())

SetClearHandler sets the callback for when the user runs /clear.

func (*Model) SetConfig

func (m *Model) SetConfig(cfg *config.Config)

SetConfig sets the config reference on the model so settings screens can perform CRUD operations.

func (*Model) SetConfigChangeHandler

func (m *Model) SetConfigChangeHandler(handler func(*config.Config))

SetConfigChangeHandler sets the callback invoked when the config changes from the settings screen (add/edit/delete provider). The app layer uses this to rebuild the registry and pipeline.

func (*Model) SetExportHandler added in v1.4.0

func (m *Model) SetExportHandler(handler func(path string))

SetExportHandler sets the callback for /export command.

func (*Model) SetMemoryHandler added in v0.2.0

func (m *Model) SetMemoryHandler(handler func(args string))

SetMemoryHandler sets the callback for /memory command.

func (*Model) SetModeChangeHandler added in v0.2.0

func (m *Model) SetModeChangeHandler(handler func(mode string))

SetModeChangeHandler sets the callback for /mode command.

func (*Model) SetModelLister added in v1.1.0

func (m *Model) SetModelLister(lister func(providerType string) []config.ModelSummary)

SetModelLister sets a callback that returns available models for a provider type. Used by the wizard to show a model list instead of requiring manual text entry.

func (*Model) SetPlanHandler added in v0.2.0

func (m *Model) SetPlanHandler(handler func(request string))

SetPlanHandler sets the callback for when the user runs /plan.

func (*Model) SetSaveHandler added in v1.4.0

func (m *Model) SetSaveHandler(handler func())

SetSaveHandler sets the callback for /save command.

func (*Model) SetSubmitHandler

func (m *Model) SetSubmitHandler(handler func(prompt string))

SetSubmitHandler sets the callback for when the user submits a prompt.

func (*Model) SetTestProviderHandler

func (m *Model) SetTestProviderHandler(handler func(providerName string))

SetTestProviderHandler sets the callback invoked when the user presses 't' in the settings screen to test a provider connection.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type PlanDoneMsg added in v0.2.0

type PlanDoneMsg struct {
	FinalOutput string
	Error       error
}

PlanDoneMsg signals that a /plan job has completed.

type ProviderChunkMsg

type ProviderChunkMsg struct {
	ProviderName string
	Delta        string
	Done         bool
	Error        error
}

ProviderChunkMsg delivers a streaming chunk from a provider.

type ProviderPanel

type ProviderPanel struct {
	Name      string
	IsPrimary bool
	Status    ProviderStatus
	Content   strings.Builder
	Viewport  viewport.Model
}

ProviderPanel holds the state for one provider's response panel.

type ProviderStatus

type ProviderStatus int

ProviderStatus tracks the state of a single provider's response.

const (
	StatusIdle ProviderStatus = iota
	StatusLoading
	StatusDone
	StatusFailed
	StatusTimedOut
)

type QueryDoneMsg

type QueryDoneMsg struct{}

QueryDoneMsg signals that the full pipeline (fan-out + consensus) is complete.

type QueryStartMsg

type QueryStartMsg struct{}

QueryStartMsg signals that a query has begun.

type Styles

type Styles struct {
	App             lipgloss.Style
	StatusBar       lipgloss.Style
	StatusHealthy   lipgloss.Style
	StatusUnhealthy lipgloss.Style
	StatusPrimary   lipgloss.Style
	PanelBorder     lipgloss.Style
	ConsensusBorder lipgloss.Style
	InputBorder     lipgloss.Style
	Title           lipgloss.Style
	Prompt          lipgloss.Style
	Dimmed          lipgloss.Style
}

Styles holds all lipgloss styles for the TUI.

type TestResultMsg

type TestResultMsg struct {
	ProviderName string
	Success      bool
	Duration     string
	Error        error
}

TestResultMsg is sent when a provider connection test completes.

type TokenUpdateMsg

type TokenUpdateMsg struct {
	Usage []tokens.ProviderUsage
}

TokenUpdateMsg delivers a snapshot of token usage for all providers.

type ToolCallMsg added in v0.2.0

type ToolCallMsg struct {
	ToolName    string
	Description string // e.g., "Reading main.go" or "Running `go test`"
}

ToolCallMsg notifies the TUI that a tool is being executed.

type WizardTestResultMsg added in v1.1.0

type WizardTestResultMsg struct {
	Success bool
	Error   error
}

WizardTestResultMsg is sent when a wizard connection test completes.

type WorkerProgressMsg added in v0.2.0

type WorkerProgressMsg struct {
	StageName    string
	Role         string
	ProviderName string
	Status       string // "pending", "running", "complete"
	Summary      string // one-line summary of output (set when complete)
}

WorkerProgressMsg updates a worker's status in the TUI during /plan execution.

Jump to

Keyboard shortcuts

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