Repository navigation
feat(tui): quick wins - input correctness, Update-loop I/O, dead boilerplate, shared render helpers - #1651
Conversation
Use keys.PrintableText for the conversation-selector and task-management search boxes so multibyte runes and the space bar land in the query, and trim a full rune on backspace instead of a byte.
time.Sleep(constants.TestSleepDelay/10) is a test-support pacing constant that added 10ms of latency to every list load; the constants import goes with it.
performDelete now returns a tea.Cmd that captures the repo and the conversation ID and delivers a conversationDeletedMsg result; removing the row and syncTable run in Update when the message arrives.
handlePaste reads the clipboard, writes and optimizes pasted images inside its returned tea.Cmd and delivers a PasteResultMsg; AddImageAttachment, SetText and SetCursor run in Update via keybinding.HandlePasteResult, together with the status flash. Covered by a table test against the fake input component.
…vars Building both maps on every transition check was per-frame work; they are immutable data that belong at package level, and the validators collapse to a slices.Contains over them.
The four plan-approval cursor handlers (left/right in the editor pair and the dedicated plan-approval ones) duplicated the wrap-around logic; movePlanSelection now owns the clamp-and-emit and the handlers delegate to it.
…ew, TodoBoxView and SubagentList QueueBoxView and TodoBoxView lost their no-op Tea trio, whose Model-returning Update forced the other two to exist, and SubagentList gets a plain SetWidth instead of its live Update (the row window never used other messages); chat.go now applies resize widths directly and the list's resize tests call SetWidth.
The 16 hand-built strings.Repeat divider sites now call the existing, previously unused Provider.RenderSeparator; the three unstyled sites (help bar, conversation list footer and delete dialog) pick up the dim theme color for free, and the redundant dimColor locals go with the conversions. Box borders stay explicit.
renderFullWelcome no longer calls os.Getwd() and rebuilds the bordered box every frame - its result is memoized and invalidated on resize or theme change, exactly the two things it derives from. ConversationsLoadedEvent.Conversations becomes []convdomain.ConversationSummary, deleting the []any boxing round-trip between the load command and the selector.
…e panelShortcut type Diff, explorer, tasks, conversations, environments, tools and agents shortcuts were identical shells differing only in name, description and side effect; they now share panelShortcut with per-command constructors. The unread repo field on ConversationSelectShortcut goes too, dropping it from its three constructor callers.
…and make byte cuts rune-safe telegram/thread_render.go and agent/headless/agent_message.go carried identical capRunes, quoteBlock and maxToolResultLen declarations; they now use render.CapRunes, render.QuoteBlock and render.MaxToolResultLen. The byte cuts in render.Truncate and insights.truncate split a UTF-8 rune mid-character and now cut by rune.
|
@infer can you continue on the last todos and make this PR ready for review? |
|
Model: Todos
Pull Request✅ Infer Result: SuccessAll done - the last todos are complete and PR #1651 is ready for review with a fully green CI. What this run didFixed the failing
Confirmed the remaining acceptance-criteria groups are done (the last two commits of the previous pass, verified by a code sweep rather than the stale PR body):
Made the PR ready for review:
No schemas, gateway or SDK impact; the only knock-on is the docs ticket above. Risk note: I did not change any product behavior in this run (one test file only), and I left the pre-existing quirk that Escape does nothing while the delete-confirm dialog is up despite its footer saying "N or esc to cancel" - that predates the PR and is out of its scope; flag it if you want it fixed here or in a follow-up. Model: Tokens: 3,196,505 in · 24,343 out · 3,220,848 total (45 requests) Tool calls: 68 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
channels.max_tool_result_len (INFER_CHANNELS_MAX_TOOL_RESULT_LEN) replaces the hardcoded render.MaxToolResultLen. The Telegram thread render and the scheduled-job notifier read it through ChannelsConfig.ToolResultLimit, which falls back to 1000 when the key is unset or not positive. render.CapRunes goes away and callers use render.Truncate with the configured limit.
The confirmation stayed open while the delete command ran, so a second Y issued another delete of the same conversation and could surface a not-found error for a delete that worked. The row removal now uses slices.DeleteFunc and the loaded list is cloned with slices.Clone.
The seven panel constructors are exported but returned the unexported panelShortcut, so callers could not name the type and the tasks docs pointed at it. The type is now PanelShortcut and each constructor builds it with a keyed literal in place of the newPanelShortcut helper.
SetConfigPath and SetVersionInfo feed the memoized welcome box but left the cache valid, so a later call would keep rendering the old values.
|
🎉 This PR is included in version 0.239.0-rc.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 0.239.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #1645
Summary
Implements the TUI quick wins from issue #1645. The search input is now multibyte-safe. Update-loop I/O (delete and paste) moves onto returned tea.Cmds, per-call transition maps are hoisted, and dead model boilerplate and dead exports are deleted. All 16 divider strings route through the shared RenderSeparator, the welcome screen render is cached, and the duplicated plan-cursor handlers and panel shortcut shells are consolidated. All twelve acceptance-criteria groups from the issue are done.
The PR also adds one user-facing config key. The tool-result cap that channels apply moves out of a hardcoded constant into
channels.max_tool_result_len.New config key
channels.max_tool_result_len(envINFER_CHANNELS_MAX_TOOL_RESULT_LEN, default1000) sets how many runes of one tool call or tool result a channel forwards before cutting it with an ellipsis.ChannelsConfig.ToolResultLimit(), which falls back to 1000 when the key is unset or not positive. A negative value would otherwise panic the rune cut.DefaultChannelsConfig(), sochannels.yaml, the env override andinfer initseeding work with no extra wiring. docs/channels.md and docs/configuration-reference.md list it.Changes
Verification
go test -race -tags purego ./...runs green across all 114 packages with no data races.ToolResultLimit(set, unset, negative), theINFER_CHANNELS_MAX_TOOL_RESULT_LENenv override and the capped headless tool result. A selector test checks that a repeated Y issues one delete, and it fails without the fix.Docs
channels.max_tool_result_lenis tracked in [DOCS] Channels: configurable tool result cap (channels.max_tool_result_len) docs#1042.