1package dialog
2
3import (
4 tea "charm.land/bubbletea/v2"
5 "github.com/charmbracelet/catwalk/pkg/catwalk"
6 "github.com/charmbracelet/crush/internal/commands"
7 "github.com/charmbracelet/crush/internal/config"
8 "github.com/charmbracelet/crush/internal/permission"
9 "github.com/charmbracelet/crush/internal/session"
10)
11
12// ActionClose is a message to close the current dialog.
13type ActionClose struct{}
14
15// ActionQuit is a message to quit the application.
16type ActionQuit = tea.QuitMsg
17
18// ActionOpenDialog is a message to open a dialog.
19type ActionOpenDialog struct {
20 DialogID string
21}
22
23// ActionSelectSession is a message indicating a session has been selected.
24type ActionSelectSession struct {
25 Session session.Session
26}
27
28// ActionSelectModel is a message indicating a model has been selected.
29type ActionSelectModel struct {
30 Provider catwalk.Provider
31 Model config.SelectedModel
32 ModelType config.SelectedModelType
33}
34
35// Messages for commands
36type (
37 ActionNewSession struct{}
38 ActionToggleHelp struct{}
39 ActionToggleCompactMode struct{}
40 ActionToggleThinking struct{}
41 ActionExternalEditor struct{}
42 ActionToggleYoloMode struct{}
43 // ActionInitializeProject is a message to initialize a project.
44 ActionInitializeProject struct{}
45 ActionSummarize struct {
46 SessionID string
47 }
48 ActionPermissionResponse struct {
49 Permission permission.PermissionRequest
50 Action PermissionAction
51 }
52 // ActionRunCustomCommand is a message to run a custom command.
53 ActionRunCustomCommand struct {
54 Content string
55 Arguments []commands.Argument
56 Args map[string]string // Actual argument values
57 }
58 // ActionRunMCPPrompt is a message to run a custom command.
59 ActionRunMCPPrompt struct {
60 Title string
61 Description string
62 PromptID string
63 ClientID string
64 Arguments []commands.Argument
65 Args map[string]string // Actual argument values
66 }
67)
68
69// Messages for API key input dialog.
70type (
71 ActionChangeAPIKeyState struct {
72 State APIKeyInputState
73 }
74)
75
76// ActionCmd represents an action that carries a [tea.Cmd] to be passed to the
77// Bubble Tea program loop.
78type ActionCmd struct {
79 Cmd tea.Cmd
80}