actions.go

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