@@ -17,8 +17,6 @@ import (
17 "github.com/opencode-ai/opencode/internal/tui/util"
17 "github.com/opencode-ai/opencode/internal/tui/util"
20−// type startCompactSessionMsg struct{}
22type appModel struct {
20type appModel struct {
23 width, height int
21 width, height int
24 keyMap KeyMap
22 keyMap KeyMap
@@ -32,40 +30,6 @@ type appModel struct {
33 app *app.App
31 app *app.App
35− // selectedSession session.Session
37− // showPermissions bool
38− // permissions dialog.PermissionDialogCmp
41− // help dialog.HelpCmp
43− // showSessionDialog bool
44− // sessionDialog dialog.SessionDialog
46− // showCommandDialog bool
47− // commandDialog dialog.CommandDialog
48− // commands []dialog.Command
50− // showModelDialog bool
51− // modelDialog dialog.ModelDialog
53− // showInitDialog bool
54− // initDialog dialog.InitDialogCmp
56− // showFilepicker bool
57− // filepicker dialog.FilepickerCmp
59− // showThemeDialog bool
60− // themeDialog dialog.ThemeDialog
62− // showMultiArgumentsDialog bool
63− // multiArgumentsDialog dialog.MultiArgumentsDialogCmp
66− // compactingMessage string
69 dialog dialogs.DialogCmp
33 dialog dialogs.DialogCmp
@@ -77,32 +41,6 @@ func (a appModel) Init() tea.Cmd {
78 cmd = a.status.Init()
42 cmd = a.status.Init()
79 cmds = append(cmds, cmd)
43 cmds = append(cmds, cmd)
80− // cmd = a.help.Init()
81− // cmds = append(cmds, cmd)
82− // cmd = a.sessionDialog.Init()
83− // cmds = append(cmds, cmd)
84− // cmd = a.commandDialog.Init()
85− // cmds = append(cmds, cmd)
86− // cmd = a.modelDialog.Init()
87− // cmds = append(cmds, cmd)
88− // cmd = a.initDialog.Init()
89− // cmds = append(cmds, cmd)
90− // cmd = a.filepicker.Init()
91− // cmds = append(cmds, cmd)
92− // cmd = a.themeDialog.Init()
93− // cmds = append(cmds, cmd)
95− // Check if we should show the init dialog
96− // cmds = append(cmds, func() tea.Msg {
97− // shouldShow, err := config.ShouldShowInitDialog()
99− // return util.InfoMsg{
100− // Type: util.InfoTypeError,
101− // Msg: "Failed to check init status: " + err.Error(),
104− // return dialog.ShowInitDialogMsg{Show: shouldShow}
106 return tea.Batch(cmds...)
44 return tea.Batch(cmds...)
@@ -113,56 +51,13 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
113 switch msg := msg.(type) {
51 switch msg := msg.(type) {
114 case tea.WindowSizeMsg:
52 case tea.WindowSizeMsg:
115 return a, a.handleWindowResize(msg)
53 return a, a.handleWindowResize(msg)
116− // TODO: remove when refactor is done
117− // msg.Height -= 1 // Make space for the status bar
118− // a.width, a.height = msg.Width, msg.Height
120− // s, _ := a.status.Update(msg)
121− // a.status = s.(core.StatusCmp)
122− // updated, cmd := a.pages[a.currentPage].Update(msg)
123− // a.pages[a.currentPage] = updated.(util.Model)
124− // cmds = append(cmds, cmd)
126− // prm, permCmd := a.permissions.Update(msg)
127− // a.permissions = prm.(dialog.PermissionDialogCmp)
128− // cmds = append(cmds, permCmd)
130− // help, helpCmd := a.help.Update(msg)
131− // a.help = help.(dialog.HelpCmp)
132− // cmds = append(cmds, helpCmd)
134− // session, sessionCmd := a.sessionDialog.Update(msg)
135− // a.sessionDialog = session.(dialog.SessionDialog)
136− // cmds = append(cmds, sessionCmd)
138− // command, commandCmd := a.commandDialog.Update(msg)
139− // a.commandDialog = command.(dialog.CommandDialog)
140− // cmds = append(cmds, commandCmd)
142− // filepicker, filepickerCmd := a.filepicker.Update(msg)
143− // a.filepicker = filepicker.(dialog.FilepickerCmp)
144− // cmds = append(cmds, filepickerCmd)
146− // a.initDialog.SetSize(msg.Width, msg.Height)
148− // if a.showMultiArgumentsDialog {
149− // a.multiArgumentsDialog.SetSize(msg.Width, msg.Height)
150− // args, argsCmd := a.multiArgumentsDialog.Update(msg)
151− // a.multiArgumentsDialog = args.(dialog.MultiArgumentsDialogCmp)
152− // cmds = append(cmds, argsCmd, a.multiArgumentsDialog.Init())
155− // dialog, cmd := a.dialog.Update(msg)
156− // a.dialog = dialog.(dialogs.DialogCmp)
157− // cmds = append(cmds, cmd)
159− // return a, tea.Batch(cmds...)
161 // Dialog messages
55 // Dialog messages
162 case dialogs.OpenDialogMsg, dialogs.CloseDialogMsg:
56 case dialogs.OpenDialogMsg, dialogs.CloseDialogMsg:
163 u, dialogCmd := a.dialog.Update(msg)
57 u, dialogCmd := a.dialog.Update(msg)
164 a.dialog = u.(dialogs.DialogCmp)
58 a.dialog = u.(dialogs.DialogCmp)
165 return a, dialogCmd
59 return a, dialogCmd
60+ case commands.ShowArgumentsDialogMsg:
167 // Page change messages
62 // Page change messages
168 case page.PageChangeMsg:
63 case page.PageChangeMsg:
@@ -170,398 +65,28 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
171 // Status Messages
66 // Status Messages
172 case util.InfoMsg, util.ClearStatusMsg:
67 case util.InfoMsg, util.ClearStatusMsg:
173− s, cmd := a.status.Update(msg)
68+ s, statusCmd := a.status.Update(msg)
174 a.status = s.(core.StatusCmp)
69 a.status = s.(core.StatusCmp)
175− cmds = append(cmds, cmd)
70+ cmds = append(cmds, statusCmd)
176 return a, tea.Batch(cmds...)
71 return a, tea.Batch(cmds...)
178 case pubsub.Event[logging.LogMessage]:
74 case pubsub.Event[logging.LogMessage]:
179 // Send to the status component
75 // Send to the status component
180− s, cmd := a.status.Update(msg)
76+ s, statusCmd := a.status.Update(msg)
181 a.status = s.(core.StatusCmp)
77 a.status = s.(core.StatusCmp)
182− cmds = append(cmds, cmd)
78+ cmds = append(cmds, statusCmd)
184 // If the current page is logs, update the logs view
80 // If the current page is logs, update the logs view
185 if a.currentPage == page.LogsPage {
81 if a.currentPage == page.LogsPage {
186− updated, cmd := a.pages[a.currentPage].Update(msg)
82+ updated, pageCmd := a.pages[a.currentPage].Update(msg)
187 a.pages[a.currentPage] = updated.(util.Model)
83 a.pages[a.currentPage] = updated.(util.Model)
188− cmds = append(cmds, cmd)
84+ cmds = append(cmds, pageCmd)
190 return a, tea.Batch(cmds...)
86 return a, tea.Batch(cmds...)
193− // case pubsub.Event[permission.PermissionRequest]:
194− // a.showPermissions = true
195− // return a, a.permissions.SetPermissions(msg.Payload)
196− // case dialog.PermissionResponseMsg:
198− // switch msg.Action {
199− // case dialog.PermissionAllow:
200− // a.app.Permissions.Grant(msg.Permission)
201− // case dialog.PermissionAllowForSession:
202− // a.app.Permissions.GrantPersistant(msg.Permission)
203− // case dialog.PermissionDeny:
204− // a.app.Permissions.Deny(msg.Permission)
206− // a.showPermissions = false
210− // case dialog.ThemeChangedMsg:
211− // updated, cmd := a.pages[a.currentPage].Update(msg)
212− // a.pages[a.currentPage] = updated.(util.Model)
213− // a.showThemeDialog = false
214− // return a, tea.Batch(cmd, util.ReportInfo("Theme changed to: "+msg.ThemeName))
216− // case dialog.CloseSessionDialogMsg:
217− // a.showSessionDialog = false
220− // case dialog.CloseCommandDialogMsg:
221− // a.showCommandDialog = false
224− // case startCompactSessionMsg:
225− // // Start compacting the current session
226− // a.isCompacting = true
227− // a.compactingMessage = "Starting summarization..."
229− // if a.selectedSession.ID == "" {
230− // a.isCompacting = false
231− // return a, util.ReportWarn("No active session to summarize")
234− // // Start the summarization process
235− // return a, func() tea.Msg {
236− // ctx := context.Background()
237− // a.app.CoderAgent.Summarize(ctx, a.selectedSession.ID)
241− // case pubsub.Event[agent.AgentEvent]:
242− // payload := msg.Payload
243− // if payload.Error != nil {
244− // a.isCompacting = false
245− // return a, util.ReportError(payload.Error)
248− // a.compactingMessage = payload.Progress
250− // if payload.Done && payload.Type == agent.AgentEventTypeSummarize {
251− // a.isCompacting = false
252− // return a, util.ReportInfo("Session summarization complete")
253− // } else if payload.Done && payload.Type == agent.AgentEventTypeResponse && a.selectedSession.ID != "" {
254− // model := a.app.CoderAgent.Model()
255− // contextWindow := model.ContextWindow
256− // tokens := a.selectedSession.CompletionTokens + a.selectedSession.PromptTokens
257− // if (tokens >= int64(float64(contextWindow)*0.95)) && config.Get().AutoCompact {
258− // return a, util.CmdHandler(startCompactSessionMsg{})
261− // // Continue listening for events
264− // case dialog.CloseThemeDialogMsg:
265− // a.showThemeDialog = false
268− // case dialog.CloseModelDialogMsg:
269− // a.showModelDialog = false
272− // case dialog.ModelSelectedMsg:
273− // a.showModelDialog = false
275− // model, err := a.app.CoderAgent.Update(config.AgentCoder, msg.Model.ID)
277− // return a, util.ReportError(err)
280− // return a, util.ReportInfo(fmt.Sprintf("Model changed to %s", model.Name))
282− // case dialog.ShowInitDialogMsg:
283− // a.showInitDialog = msg.Show
286− // case dialog.CloseInitDialogMsg:
287− // a.showInitDialog = false
288− // if msg.Initialize {
289− // // Run the initialization command
290− // for _, cmd := range a.commands {
291− // if cmd.ID == "init" {
292− // // Mark the project as initialized
293− // if err := config.MarkProjectInitialized(); err != nil {
294− // return a, util.ReportError(err)
296− // return a, cmd.Handler(cmd)
300− // // Mark the project as initialized without running the command
301− // if err := config.MarkProjectInitialized(); err != nil {
302− // return a, util.ReportError(err)
307− // case chat.SessionSelectedMsg:
308− // a.selectedSession = msg
309− // a.sessionDialog.SetSelectedSession(msg.ID)
311− // case pubsub.Event[session.Session]:
312− // if msg.Type == pubsub.UpdatedEvent && msg.Payload.ID == a.selectedSession.ID {
313− // a.selectedSession = msg.Payload
315− // case dialog.SessionSelectedMsg:
316− // a.showSessionDialog = false
317− // if a.currentPage == page.ChatPage {
318− // return a, util.CmdHandler(chat.SessionSelectedMsg(msg.Session))
322− // case dialog.CommandSelectedMsg:
323− // a.showCommandDialog = false
324− // // Execute the command handler if available
325− // if msg.Command.Handler != nil {
326− // return a, msg.Command.Handler(msg.Command)
328− // return a, util.ReportInfo("Command selected: " + msg.Command.Title)
330− // case dialog.ShowMultiArgumentsDialogMsg:
331− // // Show multi-arguments dialog
332− // a.multiArgumentsDialog = dialog.NewMultiArgumentsDialogCmp(msg.CommandID, msg.Content, msg.ArgNames)
333− // a.showMultiArgumentsDialog = true
334− // return a, a.multiArgumentsDialog.Init()
336− // case dialog.CloseMultiArgumentsDialogMsg:
337− // // Close multi-arguments dialog
338− // a.showMultiArgumentsDialog = false
340− // // If submitted, replace all named arguments and run the command
342− // content := msg.Content
344− // // Replace each named argument with its value
345− // for name, value := range msg.Args {
346− // placeholder := "$" + name
347− // content = strings.ReplaceAll(content, placeholder, value)
350− // // Execute the command with arguments
351− // return a, util.CmdHandler(dialog.CommandRunCustomMsg{
352− // Content: content,
358 case tea.KeyPressMsg:
87 case tea.KeyPressMsg:
359 return a, a.handleKeyPressMsg(msg)
88 return a, a.handleKeyPressMsg(msg)
360− // if a.dialog.HasDialogs() {
361− // u, dialogCmd := a.dialog.Update(msg)
362− // a.dialog = u.(dialogs.DialogCmp)
363− // return a, dialogCmd
365− // // If multi-arguments dialog is open, let it handle the key press first
366− // if a.showMultiArgumentsDialog {
367− // args, cmd := a.multiArgumentsDialog.Update(msg)
368− // a.multiArgumentsDialog = args.(dialog.MultiArgumentsDialogCmp)
373− // case key.Matches(msg, keys.Quit):
374− // // TODO: fix this after testing
375− // // a.showQuit = !a.showQuit
376− // // if a.showHelp {
377− // // a.showHelp = false
379− // // if a.showSessionDialog {
380− // // a.showSessionDialog = false
382− // // if a.showCommandDialog {
383− // // a.showCommandDialog = false
385− // // if a.showFilepicker {
386− // // a.showFilepicker = false
387− // // a.filepicker.ToggleFilepicker(a.showFilepicker)
389− // // if a.showModelDialog {
390− // // a.showModelDialog = false
392− // // if a.showMultiArgumentsDialog {
393− // // a.showMultiArgumentsDialog = false
395− // return a, util.CmdHandler(dialogs.OpenDialogMsg{
396− // Model: quit.NewQuitDialog(),
398− // case key.Matches(msg, keys.SwitchSession):
399− // if a.currentPage == page.ChatPage && !a.showPermissions && !a.showCommandDialog {
400− // // Load sessions and show the dialog
401− // sessions, err := a.app.Sessions.List(context.Background())
403− // return a, util.ReportError(err)
405− // if len(sessions) == 0 {
406− // return a, util.ReportWarn("No sessions available")
408− // a.sessionDialog.SetSessions(sessions)
409− // a.showSessionDialog = true
413− // case key.Matches(msg, keys.Commands):
414− // if a.currentPage == page.ChatPage && !a.showPermissions && !a.showSessionDialog && !a.showThemeDialog && !a.showFilepicker {
415− // // Show commands dialog
416− // if len(a.commands) == 0 {
417− // return a, util.ReportWarn("No commands available")
419− // a.commandDialog.SetCommands(a.commands)
420− // a.showCommandDialog = true
423− // return a, util.CmdHandler(dialogs.OpenDialogMsg{
424− // Model: commands.NewCommandDialog(),
426− // case key.Matches(msg, keys.Models):
427− // if a.showModelDialog {
428− // a.showModelDialog = false
431− // if a.currentPage == page.ChatPage && !a.showPermissions && !a.showSessionDialog && !a.showCommandDialog {
432− // a.showModelDialog = true
436− // case key.Matches(msg, keys.SwitchTheme):
437− // if !a.showPermissions && !a.showSessionDialog && !a.showCommandDialog {
438− // // Show theme switcher dialog
439− // a.showThemeDialog = true
440− // // Theme list is dynamically loaded by the dialog component
441− // return a, a.themeDialog.Init()
444− // case key.Matches(msg, returnKey) || key.Matches(msg):
445− // if msg.String() == quitKey {
446− // if a.currentPage == page.LogsPage {
447− // return a, a.moveToPage(page.ChatPage)
449− // } else if !a.filepicker.IsCWDFocused() {
451− // a.showHelp = !a.showHelp
454− // if a.showInitDialog {
455− // a.showInitDialog = false
456− // // Mark the project as initialized without running the command
457− // if err := config.MarkProjectInitialized(); err != nil {
458− // return a, util.ReportError(err)
462− // if a.showFilepicker {
463− // a.showFilepicker = false
464− // a.filepicker.ToggleFilepicker(a.showFilepicker)
467− // if a.currentPage == page.LogsPage {
468− // return a, a.moveToPage(page.ChatPage)
471− // case key.Matches(msg, keys.Logs):
472− // return a, a.moveToPage(page.LogsPage)
473− // case key.Matches(msg, keys.Help):
474− // a.showHelp = !a.showHelp
476− // case key.Matches(msg, helpEsc):
477− // if a.app.CoderAgent.IsBusy() {
478− // a.showHelp = !a.showHelp
481− // case key.Matches(msg, keys.Filepicker):
482− // a.showFilepicker = !a.showFilepicker
483− // a.filepicker.ToggleFilepicker(a.showFilepicker)
487− // u, dialogCmd := a.dialog.Update(msg)
488− // a.dialog = u.(dialogs.DialogCmp)
489− // cmds = append(cmds, dialogCmd)
490− // f, filepickerCmd := a.filepicker.Update(msg)
491− // a.filepicker = f.(dialog.FilepickerCmp)
492− // cmds = append(cmds, filepickerCmd)
495− // if a.showFilepicker {
496− // f, filepickerCmd := a.filepicker.Update(msg)
497− // a.filepicker = f.(dialog.FilepickerCmp)
498− // cmds = append(cmds, filepickerCmd)
499− // // Only block key messages send all other messages down
500− // if _, ok := msg.(tea.KeyPressMsg); ok {
501− // return a, tea.Batch(cmds...)
505− // if a.showPermissions {
506− // d, permissionsCmd := a.permissions.Update(msg)
507− // a.permissions = d.(dialog.PermissionDialogCmp)
508− // cmds = append(cmds, permissionsCmd)
509− // // Only block key messages send all other messages down
510− // if _, ok := msg.(tea.KeyPressMsg); ok {
511− // return a, tea.Batch(cmds...)
515− // if a.showSessionDialog {
516− // d, sessionCmd := a.sessionDialog.Update(msg)
517− // a.sessionDialog = d.(dialog.SessionDialog)
518− // cmds = append(cmds, sessionCmd)
519− // // Only block key messages send all other messages down
520− // if _, ok := msg.(tea.KeyPressMsg); ok {
521− // return a, tea.Batch(cmds...)
525− // if a.showCommandDialog {
526− // d, commandCmd := a.commandDialog.Update(msg)
527− // a.commandDialog = d.(dialog.CommandDialog)
528− // cmds = append(cmds, commandCmd)
529− // // Only block key messages send all other messages down
530− // if _, ok := msg.(tea.KeyPressMsg); ok {
531− // return a, tea.Batch(cmds...)
535− // if a.showModelDialog {
536− // d, modelCmd := a.modelDialog.Update(msg)
537− // a.modelDialog = d.(dialog.ModelDialog)
538− // cmds = append(cmds, modelCmd)
539− // // Only block key messages send all other messages down
540− // if _, ok := msg.(tea.KeyPressMsg); ok {
541− // return a, tea.Batch(cmds...)
545− // if a.showInitDialog {
546− // d, initCmd := a.initDialog.Update(msg)
547− // a.initDialog = d.(dialog.InitDialogCmp)
548− // cmds = append(cmds, initCmd)
549− // // Only block key messages send all other messages down
550− // if _, ok := msg.(tea.KeyPressMsg); ok {
551− // return a, tea.Batch(cmds...)
555− // if a.showThemeDialog {
556− // d, themeCmd := a.themeDialog.Update(msg)
557− // a.themeDialog = d.(dialog.ThemeDialog)
558− // cmds = append(cmds, themeCmd)
559− // // Only block key messages send all other messages down
560− // if _, ok := msg.(tea.KeyPressMsg); ok {
561− // return a, tea.Batch(cmds...)
565 s, _ := a.status.Update(msg)
90 s, _ := a.status.Update(msg)
566 a.status = s.(core.StatusCmp)
91 a.status = s.(core.StatusCmp)
567 updated, cmd := a.pages[a.currentPage].Update(msg)
92 updated, cmd := a.pages[a.currentPage].Update(msg)
@@ -659,177 +184,6 @@ func (a *appModel) View() tea.View {
660 appView := lipgloss.JoinVertical(lipgloss.Top, components...)
185 appView := lipgloss.JoinVertical(lipgloss.Top, components...)
662− // if a.showPermissions {
663− // overlay := a.permissions.View().String()
664− // row := lipgloss.Height(appView) / 2
665− // row -= lipgloss.Height(overlay) / 2
666− // col := lipgloss.Width(appView) / 2
667− // col -= lipgloss.Width(overlay) / 2
668− // appView = layout.PlaceOverlay(
677− // if a.showFilepicker {
678− // overlay := a.filepicker.View().String()
679− // row := lipgloss.Height(appView) / 2
680− // row -= lipgloss.Height(overlay) / 2
681− // col := lipgloss.Width(appView) / 2
682− // col -= lipgloss.Width(overlay) / 2
683− // appView = layout.PlaceOverlay(
692− // // Show compacting status overlay
693− // if a.isCompacting {
694− // t := theme.CurrentTheme()
695− // style := lipgloss.NewStyle().
696− // Border(lipgloss.RoundedBorder()).
697− // BorderForeground(t.BorderFocused()).
698− // BorderBackground(t.Background()).
700− // Background(t.Background()).
701− // Foreground(t.Text())
703− // overlay := style.Render("Summarizing\n" + a.compactingMessage)
704− // row := lipgloss.Height(appView) / 2
705− // row -= lipgloss.Height(overlay) / 2
706− // col := lipgloss.Width(appView) / 2
707− // col -= lipgloss.Width(overlay) / 2
708− // appView = layout.PlaceOverlay(
718− // bindings := layout.KeyMapToSlice(a.keymap)
719− // if p, ok := a.pages[a.currentPage].(layout.Bindings); ok {
720− // bindings = append(bindings, p.BindingKeys()...)
722− // if a.showPermissions {
723− // bindings = append(bindings, a.permissions.BindingKeys()...)
725− // if a.currentPage == page.LogsPage {
726− // // bindings = append(bindings, logsKeyReturnKey)
728− // if !a.app.CoderAgent.IsBusy() {
729− // // bindings = append(bindings, helpEsc)
732− // a.help.SetBindings(bindings)
734− // overlay := a.help.View().String()
735− // row := lipgloss.Height(appView) / 2
736− // row -= lipgloss.Height(overlay) / 2
737− // col := lipgloss.Width(appView) / 2
738− // col -= lipgloss.Width(overlay) / 2
739− // appView = layout.PlaceOverlay(
748− // if a.showSessionDialog {
749− // overlay := a.sessionDialog.View().String()
750− // row := lipgloss.Height(appView) / 2
751− // row -= lipgloss.Height(overlay) / 2
752− // col := lipgloss.Width(appView) / 2
753− // col -= lipgloss.Width(overlay) / 2
754− // appView = layout.PlaceOverlay(
763− // if a.showModelDialog {
764− // overlay := a.modelDialog.View().String()
765− // row := lipgloss.Height(appView) / 2
766− // row -= lipgloss.Height(overlay) / 2
767− // col := lipgloss.Width(appView) / 2
768− // col -= lipgloss.Width(overlay) / 2
769− // appView = layout.PlaceOverlay(
778− // if a.showCommandDialog {
779− // overlay := a.commandDialog.View().String()
780− // row := lipgloss.Height(appView) / 2
781− // row -= lipgloss.Height(overlay) / 2
782− // col := lipgloss.Width(appView) / 2
783− // col -= lipgloss.Width(overlay) / 2
784− // appView = layout.PlaceOverlay(
793− // if a.showInitDialog {
794− // overlay := a.initDialog.View()
795− // appView = layout.PlaceOverlay(
796− // a.width/2-lipgloss.Width(overlay)/2,
797− // a.height/2-lipgloss.Height(overlay)/2,
804− // if a.showThemeDialog {
805− // overlay := a.themeDialog.View().String()
806− // row := lipgloss.Height(appView) / 2
807− // row -= lipgloss.Height(overlay) / 2
808− // col := lipgloss.Width(appView) / 2
809− // col -= lipgloss.Width(overlay) / 2
810− // appView = layout.PlaceOverlay(
819− // if a.showMultiArgumentsDialog {
820− // overlay := a.multiArgumentsDialog.View()
821− // row := lipgloss.Height(appView) / 2
822− // row -= lipgloss.Height(overlay) / 2
823− // col := lipgloss.Width(appView) / 2
824− // col -= lipgloss.Width(overlay) / 2
825− // appView = layout.PlaceOverlay(
833 t := theme.CurrentTheme()
187 t := theme.CurrentTheme()
834 if a.dialog.HasDialogs() {
188 if a.dialog.HasDialogs() {
835 layers := append(
189 layers := append(
@@ -863,63 +217,13 @@ func New(app *app.App) tea.Model {
863 loadedPages: make(map[page.PageID]bool),
217 loadedPages: make(map[page.PageID]bool),
864 keyMap: DefaultKeyMap(),
218 keyMap: DefaultKeyMap(),
866− // help: dialog.NewHelpCmp(),
867− // sessionDialog: dialog.NewSessionDialogCmp(),
868− // commandDialog: dialog.NewCommandDialogCmp(),
869− // modelDialog: dialog.NewModelDialogCmp(),
870− // permissions: dialog.NewPermissionDialogCmp(),
871− // initDialog: dialog.NewInitDialogCmp(),
872− // themeDialog: dialog.NewThemeDialogCmp(),
873− // commands: []dialog.Command{},
874 pages: map[page.PageID]util.Model{
220 pages: map[page.PageID]util.Model{
875 page.ChatPage: page.NewChatPage(app),
221 page.ChatPage: page.NewChatPage(app),
876 page.LogsPage: page.NewLogsPage(),
222 page.LogsPage: page.NewLogsPage(),
878− // filepicker: dialog.NewFilepickerCmp(app),
881 dialog: dialogs.NewDialogCmp(),
225 dialog: dialogs.NewDialogCmp(),
884− // model.RegisterCommand(dialog.Command{
886− // Title: "Initialize Project",
887− // Description: "Create/Update the OpenCode.md memory file",
888− // Handler: func(cmd dialog.Command) tea.Cmd {
889− // prompt := `Please analyze this codebase and create a OpenCode.md file containing:
890− // 1. Build/lint/test commands - especially for running a single test
891− // 2. Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
893− // The file you create will be given to agentic coding agents (such as yourself) that operate in this repository. Make it about 20 lines long.
894− // If there's already a opencode.md, improve it.
895− // If there are Cursor rules (in .cursor/rules/ or .cursorrules) or Copilot rules (in .github/copilot-instructions.md), make sure to include them.`
896− // return tea.Batch(
897− // util.CmdHandler(chat.SendMsg{
904− // model.RegisterCommand(dialog.Command{
906− // Title: "Compact Session",
907− // Description: "Summarize the current session and create a new one with the summary",
908− // Handler: func(cmd dialog.Command) tea.Cmd {
909− // return func() tea.Msg {
910− // return startCompactSessionMsg{}
914− // // Load custom commands
915− // customCommands, err := dialog.LoadCustomCommands()
917− // logging.Warn("Failed to load custom commands", "error", err)
919− // for _, cmd := range customCommands {
920− // model.RegisterCommand(cmd)
924 return model
228 return model