feat(tui): make select list column sizing configurable (#2154)

* feat(tui): make select list layout configurable

* feat(tui): tune select list column sizing

* test(tui): fix select list alignment assertions
This commit is contained in:
Markus Ylisiurunen
2026-03-14 16:50:00 +02:00
committed by GitHub
parent e5b5738255
commit c9a3d14aa5
8 changed files with 253 additions and 76 deletions
@@ -1,8 +1,13 @@
import type { ThinkingLevel } from "@mariozechner/pi-agent-core";
import { Container, type SelectItem, SelectList } from "@mariozechner/pi-tui";
import { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from "@mariozechner/pi-tui";
import { getSelectListTheme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
const THINKING_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {
minPrimaryColumnWidth: 12,
maxPrimaryColumnWidth: 32,
};
const LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {
off: "No reasoning",
minimal: "Very brief reasoning (~1k tokens)",
@@ -36,7 +41,12 @@ export class ThinkingSelectorComponent extends Container {
this.addChild(new DynamicBorder());
// Create selector
this.selectList = new SelectList(thinkingLevels, thinkingLevels.length, getSelectListTheme());
this.selectList = new SelectList(
thinkingLevels,
thinkingLevels.length,
getSelectListTheme(),
THINKING_SELECT_LIST_LAYOUT,
);
// Preselect current level
const currentIndex = thinkingLevels.findIndex((item) => item.value === currentLevel);