pi-agent: Implement operation coordination
This commit is contained in:
@@ -66,7 +66,14 @@ type presentationState struct {
|
||||
confirm bool
|
||||
targetConfirm bool
|
||||
profileConfirm bool
|
||||
confirmation *app.Confirmation
|
||||
status string
|
||||
operationStatus app.OperationStatus
|
||||
currentError *app.OperationStatus
|
||||
errorExpanded bool
|
||||
exitDeferred bool
|
||||
operationActive bool
|
||||
operationKind app.IntentKind
|
||||
applying bool
|
||||
profileTransition bool
|
||||
progressTarget string
|
||||
@@ -115,7 +122,7 @@ func (p terminalPresentation) Render(state presentationState) string {
|
||||
default:
|
||||
page = p.mainView(state, width, height)
|
||||
}
|
||||
page.status = state.status
|
||||
page.status = renderStatus(state)
|
||||
page = redactTerminalPage(page)
|
||||
// Dashboard composition retains structured Target metadata until pane sizes
|
||||
// are known. Redact the fully composed frame as the final presentation
|
||||
@@ -123,6 +130,25 @@ func (p terminalPresentation) Render(state presentationState) string {
|
||||
return profile.RedactText(p.renderShell(page, width, height))
|
||||
}
|
||||
|
||||
func renderStatus(state presentationState) string {
|
||||
var lines []string
|
||||
if state.exitDeferred {
|
||||
lines = append(lines, "Exit requested — waiting for the current mutation to finish safely")
|
||||
} else if state.operationStatus.Summary != "" {
|
||||
lines = append(lines, state.operationStatus.Summary)
|
||||
} else if state.status != "" {
|
||||
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
|
||||
}
|
||||
lines = append(lines, errorText)
|
||||
}
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
|
||||
func redactTerminalPage(page terminalPage) terminalPage {
|
||||
page.header = profile.RedactText(page.header)
|
||||
page.primary = profile.RedactText(page.primary)
|
||||
|
||||
Reference in New Issue
Block a user