Commit Graph
19 Commits
Author SHA1 Message Date
retoorandClaude Sonnet 5.5 690264013c tai.py --tui is the grr app in the terminal: a stdlib client of the grr server with every screen (drawer, bots, profile, chat with approvals, questions, files and live process cards, automations, library, projects, search, the whole settings tree, bot computer terminal, side pane), the grr palette, strings and caps read from the server; old Telegram-style scene kept as --tui-local; spec in grrtui.md with drift tests, 77 unit tests, 4 integration tests through the real binary and a real model
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 19:48:30 +02:00
retoorandClaude Sonnet 5.5 07f3b36e32 Lazy TUI, remaining gaps closed: no heartbeat, DECLRMM margins, skip-clean layout, watched user state, terminal row reuse, geometry animation
The loop now sleeps until woken (no 1 s heartbeat); SIGCHLD and a drained pty writer wake it, the latter also fixes a busy writer callback. Partial layout no longer climbs the whole tree for all-auto panels: arrange() skips panels whose box is unchanged and that nothing under them asked about (a pending flag that survives hidden ancestors), measured() keeps measures until a touch drops them, and only really arranged panels are diffed; one leaf growing in a 301-panel all-auto tree costs 0.29 ms instead of 4.6 ms. A scroll offset written out of range arranges that panel for its clamp. TuiWatched is the base for state objects (TuiStyle and TuiSpan are ones): a write to a public field touches every panel holding it, directly or through a watched list, dict or set. TuiTerminal keeps converted screen rows keyed by content (200x50 scroll-by-one frame 16.0 ms to 1.8 ms). The terminal scroll uses left/right margins (DECLRMM) when the startup DECRQM probe says the terminal has them, so the sidebar beside a transcript is not touched (3-line scroll at 80x24: 1354 B to 734 B in the emulator); TuiVtScreen implements the margins and answers DECRQM. The scroll cost model counts runs and style switches the way diff_row writes them and its constants were swept over 1200 recorded frames. animate() of x, y, w, h now starts from the drawn place and writes whole cells.

Not verified on a real terminal: the margin path (tmux has no DECLRMM). Remaining gaps are listed in tui.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 19:42:47 +02:00
retoorandClaude Sonnet 5.5 f22d15a2f7 Lazy TUI, the rest: watched state, incremental layout, terminal scroll, row reuse, event-driven loop
Closes every gap listed under "Lazy rendering gaps" in tui.md.

State a panel keeps in a list, dict or set (nested, depth cap 4) or a TuiStyle is watched, so an in-place mutation repaints the panel with no touch(). Layout arranges only the subtrees that asked, from the nearest ancestor with a fixed size, and a touched auto-sized panel is measured again so text that grows relays out; app.verify checks every partial pass against a full arrange. A log that scrolls moves the terminal's rows (DECSTBM, IND, RI) when an exact cost count says it writes less, and keeps each line's converted row (cap 4096), so a 3-line scroll at 200x50 writes 1.8 KB instead of 7.9 KB and a line appended while pinned costs 0.6 ms. The main loop sleeps until a timer, an animation, a half-read key or a wake() (touch from any thread, pty, SIGWINCH, quit, end of input): 5 s idle at 200x50 is 7 loop iterations and 4 ms CPU instead of 147 and 20 ms. The chat composer resizes from a TuiChange event and its spinner timer only exists during a turn, instead of 0.2 s and 0.08 s polls.

Found by the new random-tree storm and fixed: a padding, border or alignment change that left the rect the same left stale cells (it was in v1.34.0); a bordered, padded log built a pad row too wide. Known and documented, not changed: animate() on x, y, w, h cannot work because positions and sizes read ints only.

Tests: TuiObservedTests (every mutator), TuiLayoutTests (random trees, partial equals full), TuiScrollTests (VT replay, overlays, resizes), TuiLoopTests (the real _main on pipes: wakeups, latency, timers, signals); twelve mutants of the new code were each caught. VERSION is left to the pending 1.35.0 work in the same file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 17:54:30 +02:00
retoor dfc97c31be Update. 2026-10-12 17:02:51 +02:00
retoorandClaude Sonnet 5.5 4fb146edb2 Lazy TUI rendering: per-panel cell cache, front-to-back occlusion, damage rects; a typed character costs 0.08 ms instead of 4.6 ms at 200x50, an unchanged frame writes nothing
Panels cache their painted cells and repaint only after touch(); any attribute write on a mounted panel is the change signal. The compositor builds a frame front to back with per-row coverage (a fully covered panel is never painted), keeps the screen it believes is shown, and recomposes and diffs only damaged rects, with a layout pass that diffs panel geometry. Anonymous dirty_paint()/dirty_layout() still drop every cache, so unaudited callers are slow, never wrong. Also: TuiStyle.key() cached, measure() memoized per layout pass, hit map built on first mouse event, damage recorded under a lock for turn threads, rect count capped at 64.

The original compositor is kept as compose_reference; TAI_TUI_VERIFY=1 checks every frame against it. New TuiLazyTests: seeded 400-step storm replayed through the VT emulator, mutation checks, thread race, laziness counters.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 15:10:02 +02:00
retoorandClaude Sonnet 5.5 1367373792 Theme switch repaints every cell: cells are diffed by role name, so F4 left old-theme speckles on spaces and unchanged glyphs; fix a loop-less live stream test that never fired its timers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 14:34:54 +02:00
retoorandClaude Sonnet 5.5 d030a4a1d3 Shell output streams live as a scrolling message in the chat TUI and REPL; commands that stop on a prompt (sudo, ssh, y/n) run on a pty and ask you, with the wait excluded from the timeout
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 13:49:52 +02:00
retoorandClaude Sonnet 5.5 72f337f012 Chat TUI: one session per bot, so a long task in one bot never blocks talking to another; background approvals wait for you, counted stdio guard for concurrent turns
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 13:06:35 +02:00
retoorandClaude Sonnet 5.5 3c3c498b49 Input history lives in the sealed vault (input_history table) shared by the REPL and chat TUI; one-time import of the old history file
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 12:56:46 +02:00
retoorandClaude Sonnet 5.5 305b8f747e Chat composer: readline-style input history with Up/Down, shared with the REPL history file
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 12:50:17 +02:00
retoorandClaude Sonnet 5.5 80bb245be7 TUI: honest phases (thinking/running/typing/online) with animation, real approval and ask_user dialogs instead of silent denial, 18x faster frames, paint on input, fd fixes for turn-thread stdout swap
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 12:45:50 +02:00
retoorandClaude Sonnet 5.5 e8e88cb741 TUI loop is asyncio: readers/writers plus frame clock, agent turns offloaded to a thread so the UI never freezes; spinner while thinking
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 12:23:57 +02:00
retoorandClaude Sonnet 5.5 ac813ab731 Redesign --tui chat scene: colorful borderless layout, markdown bubbles, tool chips, rounded composer; fix clipped composer and hidden-panel gap
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 12:17:36 +02:00
retoor 3038c5724b Update 2026-10-12 00:53:52 +02:00
retoor 2e0e0547ed @-routing: leading tags select provider/model/bot with per-dir DB defaults
Leading @tags on any turn now route and pin: @provider pins the
backend, @model-id pins a model, @botname routes one turn (bare
@bot switches sticky), tags combine freely, @auto clears the pins,
and @path references a file by absolute path. Selections save into
the dir_defaults table keyed by directory and re-apply on next boot
there. Completion for all four kinds in the REPL (readline) and in
TUI textboxes (mentions= source on TuiTextBox/TuiPromptDialog).

Bump 1.22.0 -> 1.22.1.
2026-10-11 02:28:01 +02:00
retoor 147e46f89b TUI: bracketed paste plus slash-command autocomplete
Paste: enable CSI ? 2004 mode, parse ESC[200~...ESC[201~ into one
TuiPaste event routed to the focused panel, literal body, over-cap
pastes dropped whole. TextBox inserts with CR/CRLF normalized,
Terminal queues bytes to the pty, unmarked CRLF coalesces to one
Enter, idle flush no longer shreds slow pastes.

Complete: new TuiAutocomplete popup owned by TuiTextBox via
complete=, typing filters, arrows move, Enter accepts, Esc
dismisses. tui_complete_command feeds COMMANDS with HELP_TEXT
descriptions. Demo prompt dialog wired as the showcase.
2026-10-11 00:55:33 +02:00
retoor 16211480a7 Update 2026-10-11 00:10:46 +02:00
retoor 871f3e5ae6 Docs audit: fix stale claims, cross-link hub docs
- README: 42 tools (was 38), /demo row, TUI section, testing plus
  integration line, full layout map
- tui.md: research link, tests pointer, soften shot-tested claim
- AGENTS.md/tests/README.md/research hubs: cross-links between docs
- Research: forward-correct tui conclusion plus INDEX activity row
  (19 failures fixed, tai_pkg deleted, 320/320 green); audit PASS
2026-10-10 23:51:06 +02:00
retoor 29c489e27a Standalone tai.py: native TUI framework, grouped classes, full suite green
- In-tai.py TUI framework (panels, compositor, z-layers, mouse, focus,
  VT screen, pty sub-terminals, widgets, animation) plus /demo, --demo,
  --demo-shot, tui.md docs, and research/tui-framework-design archive
- Focus safety: Tab/Shift+Tab always cycle, auto-focus prefers
  non-terminals, dialogs restore previous focus on close
- Native Consts/Install/Sandbox/Opencode/SysInfo classes in tai.py;
  module functions delegate so live patches apply; fixes 19 failures
- Retargeted 4 test patches to the real tai.* seams (assertions unchanged)
- Deleted tai_pkg/; tai.py is standalone stdlib-only (bare copy imports)
- AGENTS.md/README.md updated to the standalone architecture
- test_tai.py 320/320 OK, test_seal.py 16/16 OK
2026-10-10 23:45:12 +02:00