sidebar

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LayoutConfig added in v1.19.1

type LayoutConfig struct {
	// PaddingLeft is the space between the left edge of the sidebar and content.
	// This replaces the external wrapper padding that was previously in chat.go.
	PaddingLeft int
	// PaddingRight is the space between the content and the right edge (when no scrollbar).
	PaddingRight int
	// ScrollbarGap is the space between content and the scrollbar when visible.
	ScrollbarGap int
}

LayoutConfig defines the spacing and sizing parameters for the sidebar. All values are in terminal columns.

Layout diagram for vertical mode:

|<-- outerWidth (m.width) ----------------------->|
|<-PL->|<-- contentWidth -->|<-SG->|<-SW->|
|      |   Tab Title────────|      |  │   |
|      |   Content here     |      |  │   |
|      |                    |      |  │   |

PL = PaddingLeft, SG = ScrollbarGap, SW = scrollbar.Width

func DefaultLayoutConfig added in v1.19.1

func DefaultLayoutConfig() LayoutConfig

DefaultLayoutConfig returns the default sidebar layout configuration.

func (LayoutConfig) Compute added in v1.19.1

func (cfg LayoutConfig) Compute(outerWidth int, scrollbarVisible bool) Metrics

Compute calculates the layout metrics for the given outer width and scrollbar visibility.

type Metrics added in v1.19.1

type Metrics struct {
	// OuterWidth is the total width allocated to the sidebar.
	OuterWidth int
	// ContentWidth is the width available for actual content (tabs, text, etc.).
	ContentWidth int
	// ScrollbarVisible indicates whether the scrollbar will be rendered.
	ScrollbarVisible bool
	// contains filtered or unexported fields
}

Metrics holds the computed layout metrics for a given render pass.

func (Metrics) PaddingLeft added in v1.19.1

func (m Metrics) PaddingLeft() int

PaddingLeft returns the left padding from the config.

func (Metrics) PaddingRight added in v1.19.1

func (m Metrics) PaddingRight() int

PaddingRight returns the right padding from the config.

func (Metrics) ScrollbarGap added in v1.19.1

func (m Metrics) ScrollbarGap() int

ScrollbarGap returns the scrollbar gap from the config.

type Mode added in v1.8.2

type Mode int
const (
	ModeVertical Mode = iota
	ModeHorizontal
)

type Model

type Model interface {
	layout.Model
	layout.Sizeable
	layout.Positionable

	SetTokenUsage(event *runtime.TokenUsageEvent)
	SetTodos(result *tools.ToolCallResult) error
	SetMode(mode Mode)
	SetAgentInfo(agentName, model, description string)
	SetTeamInfo(availableAgents []runtime.AgentDetails)
	SetAgentSwitching(switching bool)
	SetToolsetInfo(availableTools int, loading bool)
	SetSessionStarred(starred bool)
	GetSize() (width, height int)
	LoadFromSession(sess *session.Session)
	// HandleClick checks if click is on the star and returns true if handled
	HandleClick(x, y int) bool
}

Model represents a sidebar component

func New

func New(sessionState *service.SessionState, opts ...Option) Model

type Option added in v1.19.1

type Option func(*model)

Option is a functional option for configuring the sidebar.

func WithLayoutConfig added in v1.19.1

func WithLayoutConfig(cfg LayoutConfig) Option

WithLayoutConfig sets a custom layout configuration.

Jump to

Keyboard shortcuts

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