package tui import ( "fmt" "git.a-wan.net/alan/pipelines/internal/protocol" tea "github.com/charmbracelet/bubbletea" ) func (m Model) updateActionConfirm(msg tea.KeyMsg) (tea.Model, tea.Cmd) { switch msg.String() { case "esc", "n": m.actionConfirm = nil return m, nil case "y": request := *m.actionConfirm m.actionConfirm = nil m.actionApproved = true return m.sendRunRequest(request) case "j", "down", "pgdown": m.actionConfirmTop++ case "k", "up", "pgup": m.actionConfirmTop = max(0, m.actionConfirmTop-1) } return m, nil } func (m Model) confirmMutation(title string, cmd func() tea.Cmd) (tea.Model, tea.Cmd) { m.mutationTitle = title m.mutationCommand = cmd m.mutationTop = 0 return m, nil } func (m Model) actionConfirmView(height int) string { r := m.actionConfirm lines := []string{"Start pipeline run?", fmt.Sprintf("Pipeline #%d · v%d", r.PipelineID, r.Version), "Directory: " + r.Workspace, "This may edit files, execute commands and publish notifications."} if r.Type == protocol.RetryRun { lines = []string{fmt.Sprintf("Retry failed run #%d?", r.RunID), "Starts a NEW run from the entry stage with fresh configured-harness sessions.", "Reuses the original input, directory, pinned version and edit scope.", "Previous side effects are not undone; commands/notifications may repeat."} } if r.Type == protocol.CancelRun { lines = []string{fmt.Sprintf("Cancel run #%d?", r.RunID), "Stops execution and interrupts its active agent.", "Sessions/history are retained; previous side effects are not undone."} } return wrappedDialog(m.width, height, 96, lines[0], lines[1:], "y confirm · n / Esc cancel", m.actionConfirmTop) }