dialog

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const APIKeyInputID = "api_key_input"

APIKeyInputID is the identifier for the model selection dialog.

View Source
const ArgumentsID = "arguments"

ArgumentsID is the identifier for the arguments dialog.

View Source
const CommandsID = "commands"

CommandsID is the identifier for the commands dialog.

View Source
const (
	DiffReviewID = "diff_review"
)
View Source
const FilePickerID = "filepicker"

FilePickerID is the identifier for the FilePicker dialog.

View Source
const ModelsID = "models"

ModelsID is the identifier for the model selection dialog.

View Source
const OAuthID = "oauth"

OAuthID is the identifier for the model selection dialog.

View Source
const PermissionsID = "permissions"

PermissionsID is the identifier for the permissions dialog.

View Source
const QuitID = "quit"

QuitID is the identifier for the quit dialog.

View Source
const (
	// ReasoningID is the identifier for the reasoning effort dialog.
	ReasoningID = "reasoning"
)
View Source
const SessionsID = "session"

SessionsID is the identifier for the session selector dialog.

View Source
const (
	// ThemePickerID is the identifier for the theme picker dialog.
	ThemePickerID = "theme"
)

Variables

View Source
var CloseKey = key.NewBinding(
	key.WithKeys("esc", "alt+esc"),
	key.WithHelp("esc", "exit"),
)

CloseKey is the default key binding to close dialogs.

Functions

func DrawCenter

func DrawCenter(scr uv.Screen, area uv.Rectangle, view string)

DrawCenter draws the given string view centered in the screen area.

func DrawCenterCursor

func DrawCenterCursor(scr uv.Screen, area uv.Rectangle, view string, cur *tea.Cursor)

DrawCenterCursor draws the given string view centered in the screen area and adjusts the cursor position accordingly.

func DrawOnboarding

func DrawOnboarding(scr uv.Screen, area uv.Rectangle, view string)

DrawOnboarding draws the given string view centered in the screen area.

func DrawOnboardingCursor

func DrawOnboardingCursor(scr uv.Screen, area uv.Rectangle, view string, cur *tea.Cursor)

DrawOnboardingCursor draws the given string view positioned at the bottom left area of the screen.

func InputCursor

func InputCursor(t *styles.Styles, cur *tea.Cursor) *tea.Cursor

InputCursor adjusts the cursor position for an input field within a dialog.

Types

type APIKeyInput

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

APIKeyInput represents a model selection dialog.

func NewAPIKeyInput

func NewAPIKeyInput(
	com *common.Common,
	isOnboarding bool,
	provider catwalk.Provider,
	model config.SelectedModel,
	modelType config.SelectedModelType,
) (*APIKeyInput, tea.Cmd)

NewAPIKeyInput creates a new Models dialog.

func (*APIKeyInput) Cursor

func (m *APIKeyInput) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog.

func (*APIKeyInput) Draw

func (m *APIKeyInput) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*APIKeyInput) FullHelp

func (m *APIKeyInput) FullHelp() [][]key.Binding

FullHelp returns the full help view.

func (*APIKeyInput) HandleMsg

func (m *APIKeyInput) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*APIKeyInput) ID

func (m *APIKeyInput) ID() string

ID implements Dialog.

func (*APIKeyInput) ShortHelp

func (m *APIKeyInput) ShortHelp() []key.Binding

ShortHelp returns the full help view.

type APIKeyInputState

type APIKeyInputState int
const (
	APIKeyInputStateInitial APIKeyInputState = iota
	APIKeyInputStateVerifying
	APIKeyInputStateVerified
	APIKeyInputStateError
)

type Action

type Action any

Action represents an action taken in a dialog after handling a message.

type ActionChangeAPIKeyState

type ActionChangeAPIKeyState struct {
	State APIKeyInputState
}

Messages for API key input dialog.

type ActionClose

type ActionClose struct{}

ActionClose is a message to close the current dialog.

type ActionCmd

type ActionCmd struct {
	Cmd tea.Cmd
}

ActionCmd represents an action that carries a tea.Cmd to be passed to the Bubble Tea program loop.

type ActionCompleteOAuth

type ActionCompleteOAuth struct {
	Token *oauth.Token
}

ActionCompleteOAuth is sent when the device flow completes successfully.

type ActionDisableDockerMCP

type ActionDisableDockerMCP struct{}

ActionDisableDockerMCP is a message to disable Docker MCP.

type ActionEnableDockerMCP

type ActionEnableDockerMCP struct{}

ActionEnableDockerMCP is a message to enable Docker MCP.

type ActionExternalEditor

type ActionExternalEditor struct{}

Messages for commands

type ActionFilePickerSelected

type ActionFilePickerSelected struct {
	Path string
}

ActionFilePickerSelected is a message indicating a file has been selected in the file picker dialog.

func (ActionFilePickerSelected) Cmd

Cmd returns a command that reads the file at path and sends a message.Attachement to the program.

type ActionInitializeProject

type ActionInitializeProject struct{}

Messages for commands

type ActionInitiateOAuth

type ActionInitiateOAuth struct {
	DeviceCode      string
	UserCode        string
	ExpiresIn       int
	VerificationURL string
	Interval        int
}

ActionInitiateOAuth is sent when the device auth is initiated successfully.

type ActionNewSession

type ActionNewSession struct{}

Messages for commands

type ActionOAuthErrored

type ActionOAuthErrored struct {
	Error error
}

ActionOAuthErrored is sent when the device flow encounters an error.

type ActionOpenDialog

type ActionOpenDialog struct {
	DialogID string
}

ActionOpenDialog is a message to open a dialog.

type ActionPermissionResponse

type ActionPermissionResponse struct {
	Permission permission.PermissionRequest
	Action     PermissionAction
}

Messages for commands

type ActionQuit

type ActionQuit = tea.QuitMsg

ActionQuit is a message to quit the application.

type ActionRunCustomCommand

type ActionRunCustomCommand struct {
	Content   string
	Arguments []commands.Argument
	Args      map[string]string // Actual argument values
}

ActionRunCustomCommand is a message to run a custom command.

type ActionRunMCPPrompt

type ActionRunMCPPrompt struct {
	Title       string
	Description string
	PromptID    string
	ClientID    string
	Arguments   []commands.Argument
	Args        map[string]string // Actual argument values
}

ActionRunMCPPrompt is a message to run a custom command.

type ActionSelectModel

type ActionSelectModel struct {
	Provider       catwalk.Provider
	Model          config.SelectedModel
	ModelType      config.SelectedModelType
	ReAuthenticate bool
}

ActionSelectModel is a message indicating a model has been selected.

type ActionSelectReasoningEffort

type ActionSelectReasoningEffort struct {
	Effort string
}

ActionSelectReasoningEffort is a message indicating a reasoning effort has been selected.

type ActionSelectSession

type ActionSelectSession struct {
	Session session.Session
}

ActionSelectSession is a message indicating a session has been selected.

type ActionSetTheme

type ActionSetTheme struct {
	Theme string
}

Messages for commands

type ActionShare

type ActionShare struct{}

Messages for commands

type ActionSummarize

type ActionSummarize struct {
	SessionID string
}

Messages for commands

type ActionToggleCompactMode

type ActionToggleCompactMode struct{}

Messages for commands

type ActionToggleHelp

type ActionToggleHelp struct{}

Messages for commands

type ActionToggleNotifications

type ActionToggleNotifications struct{}

Messages for commands

type ActionTogglePills

type ActionTogglePills struct{}

Messages for commands

type ActionTogglePlanMode

type ActionTogglePlanMode struct{}

Messages for commands

type ActionToggleThinking

type ActionToggleThinking struct{}

Messages for commands

type ActionToggleTransparentBackground

type ActionToggleTransparentBackground struct{}

Messages for commands

type ActionToggleYoloMode

type ActionToggleYoloMode struct{}

Messages for commands

type ActionUnshare

type ActionUnshare struct{}

Messages for commands

type Arguments

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

Arguments represents a dialog for collecting command arguments.

func NewArguments

func NewArguments(com *common.Common, title, description string, arguments []commands.Argument, resultAction Action) *Arguments

NewArguments creates a new arguments dialog.

func (*Arguments) Cursor

func (a *Arguments) Cursor(descriptionHeight int) *tea.Cursor

Cursor returns the cursor position relative to the dialog. we pass the description height to offset the cursor correctly.

func (*Arguments) Draw

func (a *Arguments) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Arguments) FullHelp

func (a *Arguments) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*Arguments) HandleMsg

func (a *Arguments) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*Arguments) ID

func (a *Arguments) ID() string

ID implements Dialog.

func (*Arguments) ShortHelp

func (a *Arguments) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

func (*Arguments) StartLoading

func (a *Arguments) StartLoading() tea.Cmd

StartLoading implements LoadingDialog.

func (*Arguments) StopLoading

func (a *Arguments) StopLoading()

StopLoading implements LoadingDialog.

type CommandItem

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

CommandItem wraps a uicmd.Command to implement the ListItem interface.

func NewCommandItem

func NewCommandItem(t *styles.Styles, id, title, shortcut string, action Action) *CommandItem

NewCommandItem creates a new CommandItem.

func (*CommandItem) Action

func (c *CommandItem) Action() Action

Action returns the action associated with the command item.

func (*CommandItem) Filter

func (c *CommandItem) Filter() string

Filter implements ListItem.

func (*CommandItem) ID

func (c *CommandItem) ID() string

ID implements ListItem.

func (*CommandItem) Render

func (c *CommandItem) Render(width int) string

Render implements ListItem.

func (*CommandItem) SetFocused

func (c *CommandItem) SetFocused(focused bool)

SetFocused implements ListItem.

func (*CommandItem) SetMatch

func (c *CommandItem) SetMatch(m fuzzy.Match)

SetMatch implements ListItem.

func (*CommandItem) Shortcut

func (c *CommandItem) Shortcut() string

Shortcut returns the shortcut associated with the command item.

type CommandType

type CommandType uint

CommandType represents the type of commands being displayed.

const (
	SystemCommands CommandType = iota
	UserCommands
	MCPPrompts
)

func (CommandType) String

func (c CommandType) String() string

String returns the string representation of the CommandType.

type Commands

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

func NewCommands

func NewCommands(com *common.Common, sessionID string, hasSession, hasTodos, hasQueue bool, customCommands []commands.CustomCommand, mcpPrompts []commands.MCPPrompt) (*Commands, error)

NewCommands creates a new commands dialog.

func (*Commands) Cursor

func (c *Commands) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog.

func (*Commands) Draw

func (c *Commands) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Commands) FullHelp

func (c *Commands) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*Commands) HandleMsg

func (c *Commands) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*Commands) ID

func (c *Commands) ID() string

ID implements Dialog.

func (*Commands) InitialCmd

func (c *Commands) InitialCmd() tea.Cmd

func (*Commands) SetCustomCommands

func (c *Commands) SetCustomCommands(customCommands []commands.CustomCommand)

SetCustomCommands sets the custom commands and refreshes the view if user commands are currently displayed.

func (*Commands) SetMCPPrompts

func (c *Commands) SetMCPPrompts(mcpPrompts []commands.MCPPrompt)

SetMCPPrompts sets the MCP prompts and refreshes the view if MCP prompts are currently displayed.

func (*Commands) ShortHelp

func (c *Commands) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

func (*Commands) StartLoading

func (a *Commands) StartLoading() tea.Cmd

StartLoading implements LoadingDialog.

func (*Commands) StopLoading

func (a *Commands) StopLoading()

StopLoading implements LoadingDialog.

type Dialog

type Dialog interface {
	// ID returns the unique identifier of the dialog.
	ID() string
	// HandleMsg processes a message and returns an action. An [Action] can be
	// anything and the caller is responsible for handling it appropriately.
	HandleMsg(msg tea.Msg) Action
	// Draw draws the dialog onto the provided screen within the specified area
	// and returns the desired cursor position on the screen.
	Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor
}

Dialog is a component that can be displayed on top of the UI.

type DiffFile

type DiffFile struct {
	FilePath string
	Hunks    []DiffHunk
}

DiffFile represents all changes for a single file.

type DiffHunk

type DiffHunk struct {
	OldStart int
	NewStart int
	OldLines int
	NewLines int
	Content  string
	Accepted bool
	Rejected bool
}

DiffHunk represents a single change block in a unified diff.

type DiffReview

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

DiffReview represents a dialog for reviewing and selectively accepting diff changes.

func NewDiffReview

func NewDiffReview(com *common.Common, files []DiffFile) *DiffReview

NewDiffReview creates a new diff review dialog.

func (*DiffReview) Cursor

func (dr *DiffReview) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog.

func (*DiffReview) Draw

func (dr *DiffReview) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*DiffReview) FullHelp

func (dr *DiffReview) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*DiffReview) HandleMsg

func (dr *DiffReview) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*DiffReview) ID

func (dr *DiffReview) ID() string

ID implements Dialog.

func (*DiffReview) ShortHelp

func (dr *DiffReview) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type DiffReviewResult

type DiffReviewResult struct {
	AcceptedHunks map[string]string // filePath -> accepted diff content
	Canceled      bool
}

DiffReviewResult is returned when the user confirms or cancels the review.

type FilePicker

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

FilePicker is a dialog that allows users to select files or directories.

func NewFilePicker

func NewFilePicker(com *common.Common) (*FilePicker, tea.Cmd)

NewFilePicker creates a new FilePicker dialog.

func (*FilePicker) CellSize

func (f *FilePicker) CellSize() fimage.CellSize

CellSize returns the cell size used for image rendering.

func (*FilePicker) Draw

func (f *FilePicker) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw renders the FilePicker dialog as a string.

func (*FilePicker) FullHelp

func (f *FilePicker) FullHelp() [][]key.Binding

FullHelp returns the full help key bindings for the FilePicker dialog.

func (*FilePicker) HandleMsg

func (f *FilePicker) HandleMsg(msg tea.Msg) Action

HandleMsg updates the FilePicker dialog based on the given message.

func (*FilePicker) ID

func (f *FilePicker) ID() string

ID returns the identifier of the FilePicker dialog.

func (*FilePicker) SetImageCapabilities

func (f *FilePicker) SetImageCapabilities(caps *common.Capabilities)

SetImageCapabilities sets the image capabilities for the FilePicker.

func (*FilePicker) ShortHelp

func (f *FilePicker) ShortHelp() []key.Binding

ShortHelp returns the short help key bindings for the FilePicker dialog.

func (*FilePicker) WorkingDir

func (f *FilePicker) WorkingDir() string

WorkingDir returns the current working directory of the FilePicker.

type ListItem

type ListItem interface {
	list.FilterableItem
	list.Focusable
	list.MatchSettable

	// ID returns the unique identifier of the item.
	ID() string
}

ListItem represents a selectable and searchable item in a dialog list.

type ListItemStyles

type ListItemStyles struct {
	ItemBlurred     lipgloss.Style
	ItemFocused     lipgloss.Style
	InfoTextBlurred lipgloss.Style
	InfoTextFocused lipgloss.Style
}

type LoadingDialog

type LoadingDialog interface {
	StartLoading() tea.Cmd
	StopLoading()
}

LoadingDialog is a dialog that can show a loading state.

type ModelGroup

type ModelGroup struct {
	Title string
	Items []*ModelItem
	// contains filtered or unexported fields
}

ModelGroup represents a group of model items.

func NewModelGroup

func NewModelGroup(t *styles.Styles, title string, configured bool, items ...*ModelItem) ModelGroup

NewModelGroup creates a new ModelGroup.

func (*ModelGroup) AppendItems

func (m *ModelGroup) AppendItems(items ...*ModelItem)

AppendItems appends [ModelItem]s to the group.

func (*ModelGroup) Render

func (m *ModelGroup) Render(width int) string

Render implements list.Item.

type ModelItem

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

ModelItem represents a list item for a model type.

func NewModelItem

func NewModelItem(t *styles.Styles, prov catwalk.Provider, model catwalk.Model, typ ModelType, showProvider bool) *ModelItem

NewModelItem creates a new ModelItem.

func (*ModelItem) Filter

func (m *ModelItem) Filter() string

Filter implements ListItem.

func (*ModelItem) ID

func (m *ModelItem) ID() string

ID implements ListItem.

func (*ModelItem) Render

func (m *ModelItem) Render(width int) string

Render implements ListItem.

func (*ModelItem) SelectedModel

func (m *ModelItem) SelectedModel() config.SelectedModel

SelectedModel returns this model item as a config.SelectedModel instance.

func (*ModelItem) SelectedModelType

func (m *ModelItem) SelectedModelType() config.SelectedModelType

SelectedModelType returns the type of model represented by this item.

func (*ModelItem) SetFocused

func (m *ModelItem) SetFocused(focused bool)

SetFocused implements ListItem.

func (*ModelItem) SetMatch

func (m *ModelItem) SetMatch(fm fuzzy.Match)

SetMatch implements ListItem.

type ModelType

type ModelType int

ModelType represents the type of model to select.

const (
	ModelTypeLarge ModelType = iota
	ModelTypeSmall
)

func (ModelType) Config

func (mt ModelType) Config() config.SelectedModelType

Config returns the corresponding config model type.

func (ModelType) Placeholder

func (mt ModelType) Placeholder() string

Placeholder returns the input placeholder for the model type.

func (ModelType) String

func (mt ModelType) String() string

String returns the string representation of the ModelType.

type Models

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

Models represents a model selection dialog.

func NewModels

func NewModels(com *common.Common, isOnboarding bool) (*Models, error)

NewModels creates a new Models dialog.

func (*Models) Cursor

func (m *Models) Cursor() *tea.Cursor

Cursor returns the cursor for the dialog.

func (*Models) Draw

func (m *Models) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Models) FullHelp

func (m *Models) FullHelp() [][]key.Binding

FullHelp returns the full help view.

func (*Models) HandleMsg

func (m *Models) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*Models) ID

func (m *Models) ID() string

ID implements Dialog.

func (*Models) ShortHelp

func (m *Models) ShortHelp() []key.Binding

ShortHelp returns the short help view.

type ModelsList

type ModelsList struct {
	*list.List
	// contains filtered or unexported fields
}

ModelsList is a list specifically for model items and groups.

func NewModelsList

func NewModelsList(sty *styles.Styles, groups ...ModelGroup) *ModelsList

NewModelsList creates a new list suitable for model items and groups.

func (*ModelsList) IsSelectedFirst

func (f *ModelsList) IsSelectedFirst() bool

IsSelectedFirst checks if the selected item is the first model item.

func (*ModelsList) IsSelectedLast

func (f *ModelsList) IsSelectedLast() bool

IsSelectedLast checks if the selected item is the last model item.

func (*ModelsList) Len

func (f *ModelsList) Len() int

Len returns the number of model items across all groups.

func (*ModelsList) Render

func (f *ModelsList) Render() string

Render renders the filterable list.

func (*ModelsList) SelectFirst

func (f *ModelsList) SelectFirst() (v bool)

SelectFirst selects the first model item in the list.

func (*ModelsList) SelectLast

func (f *ModelsList) SelectLast() (v bool)

SelectLast selects the last model item in the list.

func (*ModelsList) SelectNext

func (f *ModelsList) SelectNext() (v bool)

SelectNext selects the next model item, skipping any non-focusable items like group headers and spacers.

func (*ModelsList) SelectPrev

func (f *ModelsList) SelectPrev() (v bool)

SelectPrev selects the previous model item, skipping any non-focusable items like group headers and spacers.

func (*ModelsList) SetFilter

func (f *ModelsList) SetFilter(q string)

SetFilter sets the filter query and updates the list items.

func (*ModelsList) SetGroups

func (f *ModelsList) SetGroups(groups ...ModelGroup)

SetGroups sets the model groups and updates the list items.

func (*ModelsList) SetSelected

func (f *ModelsList) SetSelected(index int)

SetSelected sets the selected item index. It overrides the base method to skip non-model items.

func (*ModelsList) SetSelectedItem

func (f *ModelsList) SetSelectedItem(itemID string)

SetSelectedItem sets the selected item in the list by item ID.

func (*ModelsList) VisibleItems

func (f *ModelsList) VisibleItems() []list.Item

VisibleItems returns the visible items after filtering.

type OAuth

type OAuth struct {
	State OAuthState
	// contains filtered or unexported fields
}

OAuth handles the OAuth flow authentication.

func NewOAuthCopilot

func NewOAuthCopilot(
	com *common.Common,
	isOnboarding bool,
	provider catwalk.Provider,
	model config.SelectedModel,
	modelType config.SelectedModelType,
) (*OAuth, tea.Cmd)

func NewOAuthHyper

func NewOAuthHyper(
	com *common.Common,
	isOnboarding bool,
	provider catwalk.Provider,
	model config.SelectedModel,
	modelType config.SelectedModelType,
) (*OAuth, tea.Cmd)

func (*OAuth) Draw

func (m *OAuth) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

View renders the device flow dialog.

func (*OAuth) FullHelp

func (m *OAuth) FullHelp() [][]key.Binding

FullHelp returns the full help view.

func (*OAuth) HandleMsg

func (m *OAuth) HandleMsg(msg tea.Msg) Action

HandleMsg handles messages and state transitions.

func (*OAuth) ID

func (m *OAuth) ID() string

ID implements Dialog.

func (*OAuth) ShortHelp

func (m *OAuth) ShortHelp() []key.Binding

ShortHelp returns the full help view.

type OAuthCopilot

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

type OAuthHyper

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

type OAuthProvider

type OAuthProvider interface {
	// contains filtered or unexported methods
}

type OAuthState

type OAuthState int

OAuthState represents the current state of the device flow.

const (
	OAuthStateInitializing OAuthState = iota
	OAuthStateDisplay
	OAuthStateSuccess
	OAuthStateError
)

type Overlay

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

Overlay manages multiple dialogs as an overlay.

func NewOverlay

func NewOverlay(dialogs ...Dialog) *Overlay

NewOverlay creates a new Overlay instance.

func (*Overlay) BringToFront

func (d *Overlay) BringToFront(dialogID string)

BringToFront brings the dialog with the specified ID to the front.

func (*Overlay) CloseDialog

func (d *Overlay) CloseDialog(dialogID string)

CloseDialog closes the dialog with the specified ID from the stack.

func (*Overlay) CloseFrontDialog

func (d *Overlay) CloseFrontDialog()

CloseFrontDialog closes the front dialog in the stack.

func (*Overlay) ContainsDialog

func (d *Overlay) ContainsDialog(dialogID string) bool

ContainsDialog checks if a dialog with the specified ID exists.

func (*Overlay) Dialog

func (d *Overlay) Dialog(dialogID string) Dialog

Dialog returns the dialog with the specified ID, or nil if not found.

func (*Overlay) DialogLast

func (d *Overlay) DialogLast() Dialog

DialogLast returns the front dialog, or nil if there are no dialogs.

func (*Overlay) Draw

func (d *Overlay) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw renders the overlay and its dialogs.

func (*Overlay) HasDialogs

func (d *Overlay) HasDialogs() bool

HasDialogs checks if there are any active dialogs.

func (*Overlay) OpenDialog

func (d *Overlay) OpenDialog(dialog Dialog)

OpenDialog opens a new dialog to the stack.

func (*Overlay) StartLoading

func (d *Overlay) StartLoading() tea.Cmd

StartLoading starts the loading state for the front dialog if it implements LoadingDialog.

func (*Overlay) StopLoading

func (d *Overlay) StopLoading()

StopLoading stops the loading state for the front dialog if it implements LoadingDialog.

func (*Overlay) Update

func (d *Overlay) Update(msg tea.Msg) tea.Msg

Update handles dialog updates.

type PermissionAction

type PermissionAction string

PermissionAction represents the user's response to a permission request.

const (
	PermissionAllow           PermissionAction = "allow"
	PermissionAllowForSession PermissionAction = "allow_session"
	PermissionDeny            PermissionAction = "deny"
)

type Permissions

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

Permissions represents a dialog for permission requests.

func NewPermissions

func NewPermissions(com *common.Common, perm permission.PermissionRequest, opts ...PermissionsOption) *Permissions

NewPermissions creates a new permissions dialog.

func (*Permissions) Draw

func (p *Permissions) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Permissions) FullHelp

func (p *Permissions) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*Permissions) HandleMsg

func (p *Permissions) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*Permissions) ID

func (*Permissions) ID() string

ID implements Dialog.

func (*Permissions) ShortHelp

func (p *Permissions) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type PermissionsOption

type PermissionsOption func(*Permissions)

PermissionsOption configures the permissions dialog.

func WithDiffMode

func WithDiffMode(split bool) PermissionsOption

WithDiffMode sets the initial diff mode (split or unified).

type Quit

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

Quit represents a confirmation dialog for quitting the application.

func NewQuit

func NewQuit(com *common.Common) *Quit

NewQuit creates a new quit confirmation dialog.

func (*Quit) Draw

func (q *Quit) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Quit) FullHelp

func (q *Quit) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*Quit) HandleMsg

func (q *Quit) HandleMsg(msg tea.Msg) Action

HandleMsg implements [Model].

func (*Quit) ID

func (*Quit) ID() string

ID implements [Model].

func (*Quit) ShortHelp

func (q *Quit) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type Reasoning

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

Reasoning represents a dialog for selecting reasoning effort.

func NewReasoning

func NewReasoning(com *common.Common) (*Reasoning, error)

NewReasoning creates a new reasoning effort dialog.

func (*Reasoning) Cursor

func (r *Reasoning) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog.

func (*Reasoning) Draw

func (r *Reasoning) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Reasoning) FullHelp

func (r *Reasoning) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*Reasoning) HandleMsg

func (r *Reasoning) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*Reasoning) ID

func (r *Reasoning) ID() string

ID implements Dialog.

func (*Reasoning) ShortHelp

func (r *Reasoning) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type ReasoningItem

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

ReasoningItem represents a reasoning effort list item.

func (*ReasoningItem) Filter

func (r *ReasoningItem) Filter() string

Filter returns the filter value for the reasoning item.

func (*ReasoningItem) ID

func (r *ReasoningItem) ID() string

ID returns the unique identifier for the reasoning effort.

func (*ReasoningItem) Render

func (r *ReasoningItem) Render(width int) string

Render returns the string representation of the reasoning item.

func (*ReasoningItem) SetFocused

func (r *ReasoningItem) SetFocused(focused bool)

SetFocused sets the focus state of the reasoning item.

func (*ReasoningItem) SetMatch

func (r *ReasoningItem) SetMatch(m fuzzy.Match)

SetMatch sets the fuzzy match for the reasoning item.

type RenderContext

type RenderContext struct {
	// Styles is the styles to use for rendering.
	Styles *styles.Styles
	// TitleStyle is the style of the dialog title by default it uses Styles.Dialog.Title
	TitleStyle lipgloss.Style
	// ViewStyle is the style of the dialog title by default it uses Styles.Dialog.View
	ViewStyle lipgloss.Style
	// TitleGradientFromColor is the color the title gradient starts by defaults its Style.Primary
	TitleGradientFromColor color.Color
	// TitleGradientToColor is the color the title gradient starts by defaults its Style.Secondary
	TitleGradientToColor color.Color
	// Width is the total width of the dialog including any margins, borders,
	// and paddings.
	Width int
	// Gap is the gap between content parts. Zero means no gap.
	Gap int
	// Title is the title of the dialog. This will be styled using the default
	// dialog title style and prepended to the content parts slice.
	Title string
	// TitleInfo is additional information to display next to the title. This
	// part is displayed as is, any styling must be applied before setting this
	// field.
	TitleInfo string
	// Parts are the rendered parts of the dialog.
	Parts []string
	// Help is the help view content. This will be appended to the content parts
	// slice using the default dialog help style.
	Help string
	// IsOnboarding indicates whether to render the dialog as part of the
	// onboarding flow. This means that the content will be rendered at the
	// bottom left of the screen.
	IsOnboarding bool
}

RenderContext is a dialog rendering context that can be used to render common dialog layouts.

func NewRenderContext

func NewRenderContext(t *styles.Styles, width int) *RenderContext

NewRenderContext creates a new RenderContext with the provided styles and width.

func (*RenderContext) AddPart

func (rc *RenderContext) AddPart(part string)

AddPart adds a rendered part to the dialog.

func (*RenderContext) Render

func (rc *RenderContext) Render() string

Render renders the dialog using the provided context.

type Session

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

Session is a session selector dialog.

func NewSessions

func NewSessions(com *common.Common, selectedSessionID string) (*Session, error)

NewSessions creates a new Session dialog.

func (*Session) Cursor

func (s *Session) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog.

func (*Session) Draw

func (s *Session) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*Session) FullHelp

func (s *Session) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*Session) HandleMsg

func (s *Session) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*Session) ID

func (s *Session) ID() string

ID implements Dialog.

func (*Session) ShortHelp

func (s *Session) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

type SessionItem

type SessionItem struct {
	session.Session
	// contains filtered or unexported fields
}

SessionItem wraps a session.Session to implement the ListItem interface.

func (*SessionItem) Cursor

func (s *SessionItem) Cursor() *tea.Cursor

Cursor returns the cursor of the update title input

func (*SessionItem) Filter

func (s *SessionItem) Filter() string

Filter returns the filterable value of the session.

func (*SessionItem) HandleInput

func (s *SessionItem) HandleInput(msg tea.Msg) tea.Cmd

HandleInput forwards input message to the update title input

func (*SessionItem) ID

func (s *SessionItem) ID() string

ID returns the unique identifier of the session.

func (*SessionItem) InputValue

func (s *SessionItem) InputValue() string

InputValue returns the updated title value

func (*SessionItem) Render

func (s *SessionItem) Render(width int) string

Render returns the string representation of the session item.

func (*SessionItem) SetFocused

func (s *SessionItem) SetFocused(focused bool)

SetFocused sets the focus state of the session item.

func (*SessionItem) SetMatch

func (s *SessionItem) SetMatch(m fuzzy.Match)

SetMatch sets the fuzzy match for the session item.

type ThemeItem

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

ThemeItem represents a theme list item.

func (*ThemeItem) Filter

func (ti *ThemeItem) Filter() string

Filter returns the filter value for the theme item.

func (*ThemeItem) ID

func (ti *ThemeItem) ID() string

ID returns the unique identifier for the theme.

func (*ThemeItem) Render

func (ti *ThemeItem) Render(width int) string

Render returns the string representation of the theme item.

func (*ThemeItem) SetFocused

func (ti *ThemeItem) SetFocused(focused bool)

SetFocused sets the focus state of the theme item.

func (*ThemeItem) SetMatch

func (ti *ThemeItem) SetMatch(m fuzzy.Match)

SetMatch sets the fuzzy match for the theme item.

type ThemePicker

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

ThemePicker represents a dialog for selecting a color theme.

func NewThemePicker

func NewThemePicker(com *common.Common) *ThemePicker

NewThemePicker creates a new theme picker dialog.

func (*ThemePicker) Cursor

func (tp *ThemePicker) Cursor() *tea.Cursor

Cursor returns the cursor position relative to the dialog.

func (*ThemePicker) Draw

func (tp *ThemePicker) Draw(scr uv.Screen, area uv.Rectangle) *tea.Cursor

Draw implements Dialog.

func (*ThemePicker) FullHelp

func (tp *ThemePicker) FullHelp() [][]key.Binding

FullHelp implements help.KeyMap.

func (*ThemePicker) HandleMsg

func (tp *ThemePicker) HandleMsg(msg tea.Msg) Action

HandleMsg implements Dialog.

func (*ThemePicker) ID

func (tp *ThemePicker) ID() string

ID implements Dialog.

func (*ThemePicker) ShortHelp

func (tp *ThemePicker) ShortHelp() []key.Binding

ShortHelp implements help.KeyMap.

Jump to

Keyboard shortcuts

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