feat: unify interactive operation coordination

This commit is contained in:
proxyctl coordinator
2026-07-17 22:23:31 +08:00
parent 177bf34354
commit 7c0b4481d7
17 changed files with 985 additions and 1013 deletions
+24 -18
View File
@@ -64,19 +64,15 @@ type presentationState struct {
detailsOffset int
form formState
confirm bool
targetConfirm bool
profileConfirm bool
confirmation *app.Confirmation
status string
operationStatus app.OperationStatus
currentError *app.OperationStatus
currentError *operationError
errorExpanded bool
errorOffset int
exitDeferred bool
operationActive bool
operationKind app.IntentKind
applying bool
profileTransition bool
progressTarget string
operationProgress map[string]app.TargetProgressPhase
}
// terminalPresentation is the terminal-presentation Module. Application
@@ -88,13 +84,15 @@ type terminalPresentation struct {
}
type terminalPage struct {
header string
primary string
context string
footer string
status string
focusLine int
dashboard *dashboardRenderState
header string
primary string
context string
footer string
status string
statusExpanded bool
statusOffset int
focusLine int
dashboard *dashboardRenderState
}
func (p terminalPresentation) Render(state presentationState) string {
@@ -123,6 +121,8 @@ func (p terminalPresentation) Render(state presentationState) string {
page = p.mainView(state, width, height)
}
page.status = renderStatus(state)
page.statusExpanded = state.errorExpanded && state.currentError != nil
page.statusOffset = state.errorOffset
page = redactTerminalPage(page)
// Dashboard composition retains structured Target metadata until pane sizes
// are known. Redact the fully composed frame as the final presentation
@@ -140,9 +140,9 @@ func renderStatus(state presentationState) string {
lines = append(lines, state.status)
}
if state.currentError != nil {
errorText := "Current error: " + state.currentError.Summary
if state.errorExpanded && state.currentError.Detail != "" {
errorText += " — " + state.currentError.Detail
errorText := "Current error: " + state.currentError.status.Summary
if state.errorExpanded && state.currentError.detail != "" {
errorText += "\n" + state.currentError.detail
}
lines = append(lines, errorText)
}
@@ -165,7 +165,13 @@ func (p terminalPresentation) renderShell(page terminalPage, width, height int)
status := ""
if page.status != "" {
wrapped := lipgloss.NewStyle().Width(width).Render(p.theme.status.Render("Status: " + page.status))
status = viewportContent(wrapped, width, min(2, lineCount(wrapped)), 0)
statusHeight := min(2, lineCount(wrapped))
statusOffset := 0
if page.statusExpanded {
statusHeight = min(lineCount(wrapped), max(3, height/2))
statusOffset = page.statusOffset
}
status = viewportContent(wrapped, width, statusHeight, statusOffset)
}
headerHeight := lineCount(header)