MCPcopy
hub / github.com/docker/docker-agent / View

Method View

pkg/tui/dialog/max_iterations.go:86–110  ·  view source on GitHub ↗

View renders the max iterations confirmation dialog

()

Source from the content-addressed store, hash-verified

84
85// View renders the max iterations confirmation dialog
86func (d *maxIterationsDialog) View() string {
87 dialogWidth := d.ComputeDialogWidth(maxIterDialogWidthPercent, maxIterDialogMinWidth, maxIterDialogMaxWidth)
88 contentWidth := dialogWidth - styles.DialogWarningStyle.GetHorizontalFrameSize()
89
90 infoText := fmt.Sprintf("Max Iterations: %d", d.maxIterations)
91 messageText := "The agent may be stuck in a loop. This can happen with smaller or less capable models."
92 questionText := "Do you want to continue for 10 more iterations?"
93
94 content := NewContent(contentWidth).
95 AddTitle("Maximum Iterations Reached").
96 AddSeparator().
97 AddContent(styles.DialogContentStyle.Render(wrapDisplayText(infoText, contentWidth))).
98 AddSpace().
99 AddContent(styles.DialogContentStyle.Render(wrapDisplayText(messageText, contentWidth))).
100 AddSpace().
101 AddContent(styles.DialogQuestionStyle.Width(contentWidth).Render(wrapDisplayText(questionText, contentWidth))).
102 AddSpace().
103 AddHelpKeys("Y", "yes", "N", "no").
104 Build()
105
106 // DialogWarningStyle already includes Padding(1, 2)
107 return styles.DialogWarningStyle.
108 Width(dialogWidth).
109 Render(content)
110}
111
112// wrapDisplayText wraps text based on display cell width.
113func wrapDisplayText(text string, maxWidth int) string {

Callers 1

PositionMethod · 0.95

Calls 11

NewContentFunction · 0.85
wrapDisplayTextFunction · 0.85
ComputeDialogWidthMethod · 0.80
AddHelpKeysMethod · 0.80
AddSpaceMethod · 0.80
AddSeparatorMethod · 0.80
AddTitleMethod · 0.80
RenderMethod · 0.65
BuildMethod · 0.45
AddContentMethod · 0.45
WidthMethod · 0.45

Tested by

no test coverage detected