dialog

package
v1.145.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const ToolRejectionDialogID = toolconfirmation.ToolRejectionDialogID

Variables

This section is empty.

Functions

func CenterPosition

func CenterPosition(screenWidth, screenHeight, dialogWidth, dialogHeight int) (row, col int)

func CloseWithElicitationResponse

func CloseWithElicitationResponse(action tools.ElicitationAction, content map[string]any, elicitationID string) tea.Cmd

CloseWithElicitationResponse returns a command that closes the dialog and sends an elicitation response.

func ContentEndRow

func ContentEndRow(dialogRow, dialogHeight int) int

func ContentStartRow

func ContentStartRow(dialogRow int, headerContent string) int

func HandleConfirmKeys

func HandleConfirmKeys(msg tea.KeyPressMsg, keyMap ConfirmKeyMap, onYes, onNo func() (layout.Model, tea.Cmd)) (layout.Model, tea.Cmd, bool)

func HandleQuit

func HandleQuit(msg tea.KeyPressMsg) tea.Cmd

func HelpKeysWidth added in v1.94.0

func HelpKeysWidth(bindings ...string) int

func IsCommandPalette added in v1.98.0

func IsCommandPalette(d Dialog) bool

IsCommandPalette reports whether d is the command palette dialog. It lets observers (e.g. the getting-started tour) detect the palette opening without coupling to the unexported concrete type.

func RenderGroupSeparator added in v1.53.0

func RenderGroupSeparator(label string, contentWidth int) string

func RenderHelp

func RenderHelp(text string, contentWidth int) string

func RenderHelpKeys

func RenderHelpKeys(contentWidth int, bindings ...string) string

func RenderSeparator

func RenderSeparator(contentWidth int) string

func RenderTitle

func RenderTitle(title string, contentWidth int, style lipgloss.Style) string

Types

type BaseDialog

type BaseDialog = common.BaseDialog

type Broadcastable added in v1.119.0

type Broadcastable = common.Broadcastable

Shared types remain aliases so existing application message switches keep working.

type CloseAllDialogsMsg

type CloseAllDialogsMsg = common.CloseAllDialogsMsg

Shared types remain aliases so existing application message switches keep working.

type CloseDialogMsg

type CloseDialogMsg = common.CloseDialogMsg

Shared types remain aliases so existing application message switches keep working.

type ClosePlanDetailMsg added in v1.119.0

type ClosePlanDetailMsg struct {
	Ref plans.Ref
}

ClosePlanDetailMsg closes the topmost dialog only when it is a plan detail dialog showing exactly Ref. The manager checks the current top when the message is applied — not when it was emitted — so duplicated closes for the same vanished plan pop at most one dialog, and a close arriving after the detail was already closed (or covered by another dialog) is a no-op instead of popping the wrong dialog.

type ConfirmKeyMap

type ConfirmKeyMap = common.ConfirmKeyMap

func DefaultConfirmKeyMap

func DefaultConfirmKeyMap() ConfirmKeyMap

type ConfirmationSessionState added in v1.109.0

type ConfirmationSessionState = toolconfirmation.ConfirmationSessionState

type Content

type Content = common.Content

func NewContent

func NewContent(contentWidth int) *Content

type Dialog

type Dialog = common.Dialog

Shared types remain aliases so existing application message switches keep working.

func NewAgentDetailsDialog added in v1.88.0

func NewAgentDetailsDialog(a runtime.AgentDetails, cfg runtime.AgentConfigInfo, usage *runtime.Usage, cost *float64) Dialog

NewAgentDetailsDialog creates the read-only Agent Inspector: an agent's static configuration combined with live state. It shows the description, a "current agent" line when live, model/fallback/thinking, the agent's latest known context usage, the sub-agent, handoff and skill lists, configured limits and enabled option flags, every toolset with a status marker and its tools (live names when started, otherwise the declared allow-list), and the slash commands it defines. The instruction/system prompt is deliberately omitted. cfg carries the inspector dataset resolved by the caller (pass the zero value to omit those sections, e.g. for remote runtimes); usage carries the agent's latest token-usage snapshot (pass nil when the agent has not run). The dialog is opened by right-clicking (or Ctrl+clicking) an agent in the sidebar. cost carries the agent's cumulative attributed cost with the same semantics as the sidebar roster (see service.SessionState AgentCost); pass nil when no cost is attributable.

func NewAttentionDialog added in v1.140.0

func NewAttentionDialog(ctx context.Context, ar *animation.Runtime, application *app.App, state *service.SessionState, event tea.Msg, registries ...*tool.Registry) Dialog

NewAttentionDialog builds a prompt without opening it or running its Init command.

func NewCommandPaletteDialog

func NewCommandPaletteDialog(categories []commands.Category) Dialog

NewCommandPaletteDialog creates a new command palette dialog.

func NewContextDialog added in v1.99.0

func NewContextDialog(breakdown *runtime.ContextBreakdown, liveSessions ...runtime.LiveSession) Dialog

NewContextDialog creates the /context dialog showing the estimated context-window composition by category, the live-session team view (explicitly compactable), plus the per-file inventory of attached files (droppable) and prompt files.

func NewCostDialog

func NewCostDialog(sess *session.Session) Dialog

func NewEffortPickerDialog added in v1.98.0

func NewEffortPickerDialog(levels []effort.Level, current effort.Level) Dialog

NewEffortPickerDialog creates an effort picker over the given supported levels. current marks the active level and is preselected; pass an empty level when the active configuration doesn't map onto a listed level (adaptive or token-based budgets).

func NewElicitationDialog

func NewElicitationDialog(message string, schema any, meta map[string]any, elicitationID ...string) Dialog

NewElicitationDialog creates a new elicitation dialog. elicitationID is variadic purely so pre-existing 3-arg callers keep compiling unchanged (see firstElicitationID for the same #3584 precedent); at most the first value is meaningful.

func NewExitConfirmationDialog

func NewExitConfirmationDialog() Dialog

NewExitConfirmationDialog creates a new exit confirmation dialog.

func NewFilePickerDialog

func NewFilePickerDialog(initialPath string) Dialog

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

func NewHelpDialog(bindings []key.Binding) Dialog

NewHelpDialog creates a new help dialog that displays all active key bindings.

func NewInterruptConfirmationDialog added in v1.121.0

func NewInterruptConfirmationDialog() Dialog

NewInterruptConfirmationDialog creates a new interrupt confirmation dialog.

func NewMCPPromptInputDialog

func NewMCPPromptInputDialog(promptName string, promptInfo tools.PromptInfo) Dialog

NewMCPPromptInputDialog creates a new MCP prompt input dialog

func NewMaxIterationsDialog

func NewMaxIterationsDialog(maxIterations int, appInstance *app.App) Dialog

NewMaxIterationsDialog creates a new max iterations confirmation dialog

func NewModelPickerDialog

func NewModelPickerDialog(models []runtime.ModelChoice) Dialog

NewModelPickerDialog creates a new model picker dialog.

func NewModelPickerDialogWithQuery added in v1.104.0

func NewModelPickerDialogWithQuery(models []runtime.ModelChoice, query string) Dialog

NewModelPickerDialogWithQuery creates a model picker and restores its filter.

func NewMultiChoiceDialog

func NewMultiChoiceDialog(config MultiChoiceConfig) Dialog

func NewOAuthAuthorizationDialog

func NewOAuthAuthorizationDialog(ctx context.Context, serverURL string, appInstance *app.App, elicitationID ...string) Dialog

NewOAuthAuthorizationDialog creates a new OAuth authorization confirmation dialog. elicitationID is variadic for the same backward-compatibility reason as NewElicitationDialog (see firstElicitationID); at most the first value is meaningful.

func NewPermissionsDialog

func NewPermissionsDialog(perms *runtime.PermissionsInfo, yoloEnabled bool) Dialog

NewPermissionsDialog creates a new dialog showing tool permission rules.

func NewPlanBrowserDialog added in v1.119.0

func NewPlanBrowserDialog(result plans.ListResult) Dialog

NewPlanBrowserDialog creates the /plans browser over a listing produced by the pkg/plans service. The dialog never touches plan storage itself: every action is emitted as a message the app model services.

func NewPlanDetailDialog added in v1.119.0

func NewPlanDetailDialog(p plans.Plan) Dialog

NewPlanDetailDialog creates the detail dialog for a plan fetched through the pkg/plans service (content included).

func NewSessionBrowserDialog

func NewSessionBrowserDialog(sessions []session.Summary, workspaceDir string) Dialog

NewSessionBrowserDialog creates a new session browser dialog. workspaceDir is the directory of the active session; sessions started there are grouped first and can be filtered with the workspace filter.

func NewSettingsDialog added in v1.104.0

func NewSettingsDialog(preferences messages.Preferences, showVisuals bool) Dialog

func NewSkillsDialog added in v1.65.0

func NewSkillsDialog(skillList []skills.Skill) Dialog

NewSkillsDialog creates the /skills dialog showing every skill exposed to the current agent.

func NewSnapshotsDialog added in v1.56.0

func NewSnapshotsDialog(fileCounts []int) Dialog

NewSnapshotsDialog creates a snapshots dialog. fileCounts must be in chronological order (oldest first).

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(ar *animation.Runtime, msg *runtime.ToolCallConfirmationEvent, sessionState ConfirmationSessionState, registries ...*tool.Registry) Dialog

func NewToolRejectionReasonDialog

func NewToolRejectionReasonDialog() Dialog

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 NewTourOfferDialog added in v1.98.0

func NewTourOfferDialog(showTelemetryNotice bool) Dialog

NewTourOfferDialog creates the first-run dialog offering the getting-started tour.

func NewURLElicitationDialog

func NewURLElicitationDialog(ctx context.Context, message, url string, elicitationID ...string) Dialog

NewURLElicitationDialog creates a new URL elicitation dialog. elicitationID is variadic for the same backward-compatibility reason as NewElicitationDialog (see firstElicitationID); at most the first value is meaningful.

func NewWorkingDirPickerDialog

func NewWorkingDirPickerDialog(ctx context.Context, 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) Update

func (d *ElicitationDialog) Update(msg tea.Msg) (layout.Model, tea.Cmd)

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 InterruptConfirmedMsg added in v1.121.0

type InterruptConfirmedMsg struct{}

InterruptConfirmedMsg is sent when the user confirms they want to interrupt the current stream.

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) Update

func (d *MCPPromptInputDialog) Update(msg tea.Msg) (layout.Model, tea.Cmd)

Update handles messages for the MCP prompt input 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
	// TopIsBackground reports whether the topmost dialog is a background
	// dialog (i.e. it should not block tab navigation).
	TopIsBackground() bool
	// TopBackgroundEvent returns the originating event of the topmost
	// background dialog, or nil if the top dialog is not a background dialog
	// or the dialog stack is empty.
	TopBackgroundEvent() tea.Msg
	// TopDialog returns the topmost dialog instance, or nil if the dialog
	// stack is empty. Used by the app model to stash a background dialog's
	// live state when the user navigates away from the tab that opened it,
	// so the same instance (with any in-progress input) can be re-opened on
	// return.
	TopDialog() Dialog
	// HasDialog reports whether pred matches any dialog in the stack,
	// visiting bottom to top. Unlike TopDialog it also sees dialogs buried
	// under other dialogs, e.g. a plan browser under a help dialog.
	HasDialog(pred func(Dialog) bool) bool
	// TakeBackgroundDialogs removes matching attention dialogs in bottom-to-top order.
	TakeBackgroundDialogs(pred func(tea.Msg) bool) []OpenDialogMsg
}

Manager manages the dialog stack and rendering

func New

func New() Manager

New creates a new dialog component manager

type MultiChoiceConfig

type MultiChoiceConfig = common.MultiChoiceConfig

type MultiChoiceOption

type MultiChoiceOption = common.MultiChoiceOption

type MultiChoiceResult

type MultiChoiceResult = common.MultiChoiceResult

type MultiChoiceResultMsg

type MultiChoiceResultMsg = common.MultiChoiceResultMsg

type OpenDialogMsg

type OpenDialogMsg = common.OpenDialogMsg

Shared types remain aliases so existing application message switches keep working.

type PlanBrowserDataMsg added in v1.119.0

type PlanBrowserDataMsg struct {
	Result plans.ListResult
}

PlanBrowserDataMsg replaces the plan browser's rows with a fresh listing. It is Broadcastable so a browser buried under the detail dialog stays in sync after a write.

func (PlanBrowserDataMsg) BroadcastToDialogs added in v1.119.0

func (PlanBrowserDataMsg) BroadcastToDialogs()

BroadcastToDialogs implements Broadcastable.

type PlanBrowserViewer added in v1.119.0

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

PlanBrowserViewer identifies the /plans browser dialog on the stack, so the app model can refuse stacking a duplicate browser. The marker method is unexported like PlanDialog's: only this package's browser implements it, while other packages can still assert against the interface.

type PlanDetailDataMsg added in v1.119.0

type PlanDetailDataMsg struct {
	Plan plans.Plan
}

PlanDetailDataMsg replaces the plan shown by an open detail dialog. It is Broadcastable for the same reason as PlanBrowserDataMsg; a detail dialog only applies it when the plan identity matches what it is showing.

func (PlanDetailDataMsg) BroadcastToDialogs added in v1.119.0

func (PlanDetailDataMsg) BroadcastToDialogs()

BroadcastToDialogs implements Broadcastable.

type PlanDetailViewer added in v1.119.0

type PlanDetailViewer interface {
	PlanRef() plans.Ref
}

PlanDetailViewer identifies an open plan detail dialog and the plan it shows, so the app model can re-fetch exactly that plan on refresh.

type PlanDialog added in v1.119.0

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

PlanDialog is implemented by every dialog of the /plans flow, so the app model can tell whether plan data is on screen and needs live refreshing.

type RuntimeResumeMsg

type RuntimeResumeMsg = toolconfirmation.RuntimeResumeMsg

func HandleToolRejectionResult

func HandleToolRejectionResult(result MultiChoiceResult) *RuntimeResumeMsg

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 = toolconfirmation.Response

type TourOfferChoice added in v1.98.0

type TourOfferChoice int

TourOfferChoice is the user's answer to the first-run tour offer.

const (
	// TourOfferAccepted starts the tour now.
	TourOfferAccepted TourOfferChoice = iota
	// TourOfferLater declines for this run; the offer may be shown again.
	TourOfferLater
	// TourOfferNever declines permanently.
	TourOfferNever
)

type TourOfferResultMsg added in v1.98.0

type TourOfferResultMsg struct {
	Choice TourOfferChoice
}

TourOfferResultMsg reports the user's choice on the tour offer dialog.

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) Update

func (d *URLElicitationDialog) Update(msg tea.Msg) (layout.Model, tea.Cmd)

func (*URLElicitationDialog) View

func (d *URLElicitationDialog) View() string

Directories

Path Synopsis
Package common provides reusable dialog models, messages, and rendering helpers.
Package common provides reusable dialog models, messages, and rendering helpers.
internal
testutil
Package testutil provides command inspection for dialog tests.
Package testutil provides command inspection for dialog tests.
Package toolconfirmation provides tool approval and rejection dialogs.
Package toolconfirmation provides tool approval and rejection dialogs.

Jump to

Keyboard shortcuts

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