Documentation
¶
Index ¶
- Constants
- func CenterPosition(screenWidth, screenHeight, dialogWidth, dialogHeight int) (row, col int)
- func CloseWithElicitationResponse(action tools.ElicitationAction, content map[string]any) tea.Cmd
- func ContentEndRow(dialogRow, dialogHeight int) int
- func ContentStartRow(dialogRow int, headerContent string) int
- func HandleConfirmKeys(msg tea.KeyPressMsg, keyMap ConfirmKeyMap, ...) (layout.Model, tea.Cmd, bool)
- func HandleQuit(msg tea.KeyPressMsg) tea.Cmd
- func RenderGroupSeparator(label string, contentWidth int) string
- func RenderHelp(text string, contentWidth int) string
- func RenderHelpKeys(contentWidth int, bindings ...string) string
- func RenderSeparator(contentWidth int) string
- func RenderTitle(title string, contentWidth int, style lipgloss.Style) string
- type BaseDialog
- func (b *BaseDialog) CenterDialog(renderedDialog string) (row, col int)
- func (b *BaseDialog) ComputeDialogWidth(percent, minWidth, maxWidth int) int
- func (b *BaseDialog) ContentWidth(dialogWidth, paddingX int) int
- func (b *BaseDialog) Height() int
- func (b *BaseDialog) SetSize(width, height int) tea.Cmd
- func (b *BaseDialog) Width() int
- type CloseAllDialogsMsg
- type CloseDialogMsg
- type ConfirmKeyMap
- type Content
- func (dc *Content) AddContent(content string) *Content
- func (dc *Content) AddHelp(text string) *Content
- func (dc *Content) AddHelpKeys(bindings ...string) *Content
- func (dc *Content) AddQuestion(question string) *Content
- func (dc *Content) AddSeparator() *Content
- func (dc *Content) AddSpace() *Content
- func (dc *Content) AddTitle(title string) *Content
- func (dc *Content) Build() string
- type Dialog
- func NewAttachmentPreviewDialog(preview editor.AttachmentPreview) Dialog
- func NewCommandPaletteDialog(categories []commands.Category) Dialog
- func NewCostDialog(sess *session.Session) Dialog
- func NewElicitationDialog(message string, schema any, meta map[string]any) Dialog
- func NewExitConfirmationDialog() Dialog
- func NewFilePickerDialog(initialPath string) Dialog
- func NewHelpDialog(bindings []key.Binding) Dialog
- func NewMCPPromptInputDialog(promptName string, promptInfo mcptools.PromptInfo) Dialog
- func NewMaxIterationsDialog(maxIterations int, appInstance *app.App) Dialog
- func NewModelPickerDialog(models []runtime.ModelChoice) Dialog
- func NewMultiChoiceDialog(config MultiChoiceConfig) Dialog
- func NewOAuthAuthorizationDialog(serverURL string, appInstance *app.App) Dialog
- func NewPermissionsDialog(perms *runtime.PermissionsInfo, yoloEnabled bool) Dialog
- func NewSessionBrowserDialog(sessions []session.Summary) Dialog
- func NewThemePickerDialog(themes []ThemeChoice, originalThemeRef string) Dialog
- func NewToolConfirmationDialog(msg *runtime.ToolCallConfirmationEvent, sessionState *service.SessionState) Dialog
- func NewToolRejectionReasonDialog() Dialog
- func NewToolsDialog(toolsets []tools.ToolsetStatus, toolList []tools.Tool) Dialog
- func NewURLElicitationDialog(message, url string) Dialog
- func NewWorkingDirPickerDialog(recentDirs, favoriteDirs []string, store *tuistate.Store, ...) Dialog
- type ElicitationDialog
- type ElicitationField
- type ExitConfirmedMsg
- type MCPPromptInputDialog
- type Manager
- type MultiChoiceConfig
- type MultiChoiceOption
- type MultiChoiceResult
- type MultiChoiceResultMsg
- type OpenDialogMsg
- type RuntimeResumeMsg
- type ThemeChoice
- type ToolConfirmationResponse
- type URLElicitationDialog
Constants ¶
const ToolRejectionDialogID = "tool-rejection-reason"
ToolRejectionDialogID is the unique identifier for the tool rejection reason dialog.
Variables ¶
This section is empty.
Functions ¶
func CenterPosition ¶
CenterPosition calculates the centered position for a dialog given screen and dialog dimensions. Returns (row, col) suitable for use in Dialog.Position().
func CloseWithElicitationResponse ¶
CloseWithElicitationResponse returns a command that closes the dialog and sends an elicitation response.
func ContentEndRow ¶
ContentEndRow returns the absolute Y row of the last content line inside a dialog. dialogRow is the top-left row and dialogHeight is the total rendered height. The dialog frame (border + padding) is accounted for automatically using DialogStyle.
func ContentStartRow ¶
ContentStartRow returns the absolute Y row where content begins inside a dialog. dialogRow is the top-left row of the dialog, and headerContent is the rendered header text above the target content area. The dialog frame (border + padding) is accounted for automatically using DialogStyle.
func HandleConfirmKeys ¶
func HandleConfirmKeys(msg tea.KeyPressMsg, keyMap ConfirmKeyMap, onYes, onNo func() (layout.Model, tea.Cmd)) (layout.Model, tea.Cmd, bool)
HandleConfirmKeys handles Yes/No key presses for confirmation dialogs. Returns the command to execute and whether a key was matched.
func HandleQuit ¶
func HandleQuit(msg tea.KeyPressMsg) tea.Cmd
HandleQuit checks for ctrl+c and returns tea.Quit if matched.
func RenderGroupSeparator ¶ added in v1.53.0
RenderGroupSeparator renders a labelled section separator inside a list, like "── Custom themes ──────────────". It is used to visually divide groups of items in a picker list.
func RenderHelp ¶
RenderHelp renders help text at the bottom of a dialog in italic muted style.
func RenderHelpKeys ¶
RenderHelpKeys renders key bindings in the same style as the main TUI's status bar. Each binding is a pair of [key, description] strings.
func RenderSeparator ¶
RenderSeparator renders a horizontal separator line.
Types ¶
type BaseDialog ¶
type BaseDialog struct {
// contains filtered or unexported fields
}
BaseDialog provides common functionality for dialog implementations. It handles size management, position calculation, and common UI patterns.
func (*BaseDialog) CenterDialog ¶
func (b *BaseDialog) CenterDialog(renderedDialog string) (row, col int)
CenterDialog returns the (row, col) position to center a rendered dialog.
func (*BaseDialog) ComputeDialogWidth ¶
func (b *BaseDialog) ComputeDialogWidth(percent, minWidth, maxWidth int) int
ComputeDialogWidth calculates dialog width based on screen percentage with bounds.
func (*BaseDialog) ContentWidth ¶
func (b *BaseDialog) ContentWidth(dialogWidth, paddingX int) int
ContentWidth calculates the inner content width given dialog width and padding.
type CloseAllDialogsMsg ¶
type CloseAllDialogsMsg struct{}
CloseAllDialogsMsg is sent to close all dialogs in the stack
type CloseDialogMsg ¶
type CloseDialogMsg struct{}
CloseDialogMsg is sent to close the current (topmost) dialog
type ConfirmKeyMap ¶
ConfirmKeyMap defines key bindings for confirmation dialogs (Yes/No).
func DefaultConfirmKeyMap ¶
func DefaultConfirmKeyMap() ConfirmKeyMap
DefaultConfirmKeyMap returns the standard Yes/No key bindings.
type Content ¶
type Content struct {
// contains filtered or unexported fields
}
Content helps build dialog content with consistent structure.
func NewContent ¶
NewContent creates a new dialog content builder.
func (*Content) AddContent ¶
AddContent adds raw content to the dialog.
func (*Content) AddHelpKeys ¶
AddHelpKeys adds key binding help at the bottom.
func (*Content) AddQuestion ¶
AddQuestion adds a styled question text.
func (*Content) AddSeparator ¶
AddSeparator adds a horizontal separator line.
type Dialog ¶
type Dialog interface {
layout.Model
Position() (int, int) // Returns (row, col) for dialog placement
}
Dialog defines the interface that all dialogs must implement
func NewAttachmentPreviewDialog ¶
func NewAttachmentPreviewDialog(preview editor.AttachmentPreview) Dialog
NewAttachmentPreviewDialog returns a dialog that shows attachment content in a scrollable view.
func NewCommandPaletteDialog ¶
NewCommandPaletteDialog creates a new command palette dialog.
func NewCostDialog ¶
func NewElicitationDialog ¶
NewElicitationDialog creates a new elicitation dialog.
func NewExitConfirmationDialog ¶
func NewExitConfirmationDialog() Dialog
NewExitConfirmationDialog creates a new exit confirmation dialog.
func NewFilePickerDialog ¶
NewFilePickerDialog creates a new file picker dialog for attaching files. If initialPath is provided and is a directory, it starts in that directory. If initialPath is a file, it starts in the file's directory with the file pre-selected.
func NewHelpDialog ¶ added in v1.41.0
NewHelpDialog creates a new help dialog that displays all active key bindings.
func NewMCPPromptInputDialog ¶
func NewMCPPromptInputDialog(promptName string, promptInfo mcptools.PromptInfo) Dialog
NewMCPPromptInputDialog creates a new MCP prompt input dialog
func NewMaxIterationsDialog ¶
NewMaxIterationsDialog creates a new max iterations confirmation dialog
func NewModelPickerDialog ¶
func NewModelPickerDialog(models []runtime.ModelChoice) Dialog
NewModelPickerDialog creates a new model picker dialog.
func NewMultiChoiceDialog ¶
func NewMultiChoiceDialog(config MultiChoiceConfig) Dialog
NewMultiChoiceDialog creates a new multi-choice dialog.
func NewOAuthAuthorizationDialog ¶
NewOAuthAuthorizationDialog creates a new OAuth authorization confirmation dialog
func NewPermissionsDialog ¶
func NewPermissionsDialog(perms *runtime.PermissionsInfo, yoloEnabled bool) Dialog
NewPermissionsDialog creates a new dialog showing tool permission rules.
func NewSessionBrowserDialog ¶
NewSessionBrowserDialog creates a new session browser dialog
func NewThemePickerDialog ¶
func NewThemePickerDialog(themes []ThemeChoice, originalThemeRef string) Dialog
NewThemePickerDialog creates a new theme picker dialog. originalThemeRef is the currently active theme ref (for restoration on cancel).
func NewToolConfirmationDialog ¶
func NewToolConfirmationDialog(msg *runtime.ToolCallConfirmationEvent, sessionState *service.SessionState) Dialog
NewToolConfirmationDialog creates a new tool confirmation dialog
func NewToolRejectionReasonDialog ¶
func NewToolRejectionReasonDialog() Dialog
NewToolRejectionReasonDialog creates a multi-choice dialog for selecting the reason for rejecting a tool call.
func NewToolsDialog ¶ added in v1.36.1
func NewToolsDialog(toolsets []tools.ToolsetStatus, toolList []tools.Tool) Dialog
NewToolsDialog creates the unified /tools dialog, showing the lifecycle status of each toolset (top section) followed by every tool exposed to the agent (bottom section, grouped by category).
The two halves are intentionally rendered together: a tool's Category is generally a functional bucket ("filesystem", "shell", "lsp"), not the toolset name, so a separate /toolsets dialog used to be the only way for users to see lifecycle state. Combining them here means a single command surfaces both "what can the agent do" and "is anything degraded".
func NewURLElicitationDialog ¶
NewURLElicitationDialog creates a new URL elicitation dialog.
func NewWorkingDirPickerDialog ¶
func NewWorkingDirPickerDialog(recentDirs, favoriteDirs []string, store *tuistate.Store, sessionWorkingDir string) Dialog
NewWorkingDirPickerDialog creates a new working directory picker dialog. recentDirs provides a list of recently used directories to show. favoriteDirs provides a list of pinned directories to show. store is used for persisting favorite directory changes (may be nil). sessionWorkingDir is the working directory of the active session; when non-empty it is used as the initial browse directory instead of the process working directory.
type ElicitationDialog ¶
type ElicitationDialog struct {
BaseDialog
// contains filtered or unexported fields
}
ElicitationDialog implements Dialog for MCP elicitation requests.
When a schema is provided, fields are rendered as a form. When no schema is provided, a single free-form text input (responseInput) is shown so the user can type an answer.
The body region (message + fields, or message + free-form input) is rendered inside a scrollview so long content remains accessible when it would otherwise overflow the terminal.
func (*ElicitationDialog) Init ¶
func (d *ElicitationDialog) Init() tea.Cmd
func (*ElicitationDialog) Position ¶
func (d *ElicitationDialog) Position() (row, col int)
func (*ElicitationDialog) View ¶
func (d *ElicitationDialog) View() string
type ElicitationField ¶
type ElicitationField struct {
Name, Title, Type, Description string
Required bool
EnumValues []string
Default any
MinLength, MaxLength int
Format, Pattern string
Minimum, Maximum float64
HasMinimum, HasMaximum bool
}
ElicitationField represents a form field extracted from a JSON schema.
type ExitConfirmedMsg ¶
type ExitConfirmedMsg struct{}
ExitConfirmedMsg is sent when the user confirms they want to exit.
type MCPPromptInputDialog ¶
type MCPPromptInputDialog struct {
BaseDialog
// contains filtered or unexported fields
}
MCPPromptInputDialog implements Dialog for collecting MCP prompt parameters
func (*MCPPromptInputDialog) Init ¶
func (d *MCPPromptInputDialog) Init() tea.Cmd
Init initializes the MCP prompt input dialog
func (*MCPPromptInputDialog) Position ¶
func (d *MCPPromptInputDialog) Position() (row, col int)
Position calculates the position to center the dialog
func (*MCPPromptInputDialog) View ¶
func (d *MCPPromptInputDialog) View() string
View renders the MCP prompt input dialog
type Manager ¶
type Manager interface {
layout.Model
GetLayers() []*lipgloss.Layer
Open() bool
TopIsExitConfirmation() bool
}
Manager manages the dialog stack and rendering
type MultiChoiceConfig ¶
type MultiChoiceConfig struct {
DialogID string // Unique identifier for this dialog instance
Title string // Dialog title (used as the main header)
Options []MultiChoiceOption // List of options (max 10 for number selection 0-9)
AllowCustom bool // Whether to allow custom text input
AllowSecondary bool // Whether to allow secondary action (e.g., skip)
SecondaryLabel string // Label for secondary button (default: "Skip")
PrimaryLabel string // Label for primary button (default: "Continue")
CustomPlaceholder string // Placeholder for custom input
}
MultiChoiceConfig configures the multi-choice dialog.
type MultiChoiceOption ¶
type MultiChoiceOption struct {
ID string // Stable identifier for the option
Label string // Display label shown to user
Value string // Value returned when selected (e.g., model-friendly sentence)
}
MultiChoiceOption represents a single selectable option in the dialog.
type MultiChoiceResult ¶
type MultiChoiceResult struct {
OptionID string // ID of the selected option ("custom" for custom input, "skip" for no reason)
Value string // The value text (option's Value or custom text)
IsCustom bool // True if user provided custom input
IsSkipped bool // True if user chose to skip (no reason)
IsCancelled bool // True if user cancelled/escaped
}
MultiChoiceResult holds the result of user selection.
type MultiChoiceResultMsg ¶
type MultiChoiceResultMsg struct {
DialogID string
Result MultiChoiceResult
}
MultiChoiceResultMsg is the tea.Msg sent when the user makes a selection.
type OpenDialogMsg ¶
type OpenDialogMsg struct {
Model Dialog
}
OpenDialogMsg is sent to open a new dialog
type RuntimeResumeMsg ¶
type RuntimeResumeMsg struct {
Request runtime.ResumeRequest
}
func HandleToolRejectionResult ¶
func HandleToolRejectionResult(result MultiChoiceResult) *RuntimeResumeMsg
HandleToolRejectionResult processes the result from the tool rejection dialog and returns the appropriate RuntimeResumeMsg. Returns nil if the result was cancelled (user should stay in confirmation dialog).
type ThemeChoice ¶
type ThemeChoice struct {
Ref string // Theme reference ("default" for built-in default)
Name string // Display name
IsCurrent bool // Currently active theme
IsDefault bool // Built-in default theme ("default")
IsBuiltin bool // Built-in theme shipped with docker agent
}
ThemeChoice represents a selectable theme option.
type ToolConfirmationResponse ¶
type ToolConfirmationResponse struct {
Response string // "approve", "reject", or "approve-session"
}
ToolConfirmationResponse represents the user's response to tool confirmation
type URLElicitationDialog ¶
type URLElicitationDialog struct {
BaseDialog
// contains filtered or unexported fields
}
URLElicitationDialog handles URL-based MCP elicitation requests. It displays a URL for the user to visit and waits for confirmation.
func (*URLElicitationDialog) Init ¶
func (d *URLElicitationDialog) Init() tea.Cmd
func (*URLElicitationDialog) Position ¶
func (d *URLElicitationDialog) Position() (row, col int)
func (*URLElicitationDialog) View ¶
func (d *URLElicitationDialog) View() string
Source Files
¶
- attachment_preview.go
- base.go
- command_palette.go
- cost.go
- dialog.go
- elicitation.go
- exit_confirmation.go
- file_picker.go
- help.go
- max_iterations.go
- mcp_prompt_input.go
- model_picker.go
- multi_choice.go
- oauth_authorization.go
- permissions.go
- picker.go
- readonly_scroll_dialog.go
- schema.go
- session_browser.go
- theme_picker.go
- tool_confirmation.go
- tool_rejection_reason.go
- tools.go
- url_elicitation.go
- validation.go
- working_dir_picker.go