NewProgram builds the Bubble Tea program. Wire the returned program to a Confirm callback and a stdout-pipe forwarder before calling Run. Pass nil for usageFunc to omit the token-usage line on the status bar. We capture the terminal width here, before main.go redirects os.Stdout to the alt-screen p
(runner AgentRunner, usageFunc UsageFunc)
| 192 | // zero, which is too late for the banner animation to detect "this |
| 193 | // terminal can render the wide wordmark." |
| 194 | func NewProgram(runner AgentRunner, usageFunc UsageFunc) *tea.Program { |
| 195 | width := TermWidth() |
| 196 | banner := BannerText(width) |
| 197 | m := newHarness(runner, usageFunc, banner) |
| 198 | m.usageFunc = usageFunc |
| 199 | m.bannerWidth = width |
| 200 | return tea.NewProgram( |
| 201 | m, |
| 202 | tea.WithAltScreen(), |
| 203 | tea.WithMouseAllMotion(), |
| 204 | ) |
| 205 | } |
| 206 | |
| 207 | func (m harness) Init() tea.Cmd { |
| 208 | // Animate the banner only when the wide variant is in play; the narrow |
no test coverage detected