graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Merge branch 'perf/tui-layout-cache' into ui/tui-hover-affordance
Rach Pradhan753f9ef11beb
diff --cc TUI/render.zigindex 6405d8ff,375cfe71..277bc2bc--- a/TUI/render.zig+++ b/TUI/render.zig@@@ -8,8 -8,7 +8,8 @@@ const anchor = @import("anchor.zig")const app = @import("app.zig");const chrome = @import("chrome.zig");const engine = @import("engine.zig");+const glyphs = @import("glyphs.zig");- const scrollback = @import("scrollback.zig");+ const layout_cache = @import("layout_cache.zig");const selection = @import("selection.zig");const theme_mod = @import("theme.zig");const welcome = @import("welcome.zig");diff --cc TUI/root.zigindex 2ced2580,0f24f9e0..8c0baba5--- a/TUI/root.zig+++ b/TUI/root.zig@@@ -59,10 -59,9 +59,11 @@@ test_ = @import("turn.zig");_ = @import("bgop.zig");_ = @import("welcome.zig");+ _ = @import("glyphs.zig");_ = @import("scrollback.zig");+ _ = @import("layout_cache.zig");_ = @import("selection.zig");+ _ = @import("selection_tests.zig");_ = @import("chrome.zig");_ = @import("models.zig");_ = @import("markdown.zig");diff --cc TUI/scrollback.zigindex 6c7e1b74,1b765a5a..c1404dc5--- a/TUI/scrollback.zig+++ b/TUI/scrollback.zig@@@ -270,9 -269,9 +271,9 @@@ pub fn row(self: *const Model, a: std.m.user => try @import("markdown.zig").renderUser(a, raw, th.accent, th.text),else => raw,};- const sel: []const u8 = if (selected) "› " else " ";+ const sel = glyphs.frame(&glyphs.row_mark, @intFromBool(!selected));if (e.kind == .user) {- const line = try std.fmt.allocPrint(a, "{s}{s}#{d}{s} {s}", .{ sel, th.muted, userNo(self, idx), theme_mod.reset, body });+ const line = try std.fmt.allocPrint(a, "{s}{s}#{d}{s} {s}", .{ sel, th.muted, user_no, theme_mod.reset, body });return theme_mod.wrapToWidth(a, line, width);}if (e.kind == .pending) {@@@ -401,14 -396,21 +402,14 @@@ fn firstLine(s: []const u8) []const u8return s;}+/// The live tail is raw model bytes: escapes, C0 controls (a CR would rewind+/// the row) and the half glyph a delta boundary left behind all have to go+/// before it reaches a frame. Same filter the finished message gets.- fn strip(a: std.mem.Allocator, s: []const u8) []const u8 {+ pub fn strip(a: std.mem.Allocator, s: []const u8) []const u8 {- var out = std.array_list.Managed(u8).init(a);- var i: usize = 0;- while (i < s.len) {- if (s[i] == 0x1b) {- i = theme_mod.skipEsc(s, i);- continue;- }- out.append(s[i]) catch {};- i += 1;- }- return out.items;+ return @import("markdown.zig").sanitize(a, s) catch s;}- fn tail(a: std.mem.Allocator, s: []const u8, width: usize, max_lines: usize) ![]const u8 {+ pub fn tail(a: std.mem.Allocator, s: []const u8, width: usize, max_lines: usize) ![]const u8 {var lines = std.array_list.Managed([]const u8).init(a);var it = std.mem.splitScalar(u8, s, '\n');// No tool-line filter any more: the live buffer carries PROSE only —diff --cc scripts/eval-tier1.shindex e3d6dc3d,a5ce6601..2ebb0550--- a/scripts/eval-tier1.sh+++ b/scripts/eval-tier1.sh@@@ -250,13 -249,13 +250,20 @@@ if wanted tuiguard; theif python3 scripts/test-tui-painter.py zig-out/bin/graff; then :; elserecord_fail tuiguardfi+ # Same invariants, read off a VIRTUAL SCREEN instead of raw bytes+ # (scripts/ptyharness.py): the VT interpreter's own selftest, the ported+ # mode-balance check, and out-of-band screen corruption fed straight to the+ # tty.+ if python3 scripts/test-tui-screenstate.py zig-out/bin/graff; then :; else+ record_fail tuiguard+ fi+ # Scrolling is a viewport SLICE of one cached layout, not a re-layout+ # (TUI/layout_cache.zig). Reads the screen back on every scroll step and+ # after every width change: the markers on screen must be a contiguous+ # ascending run, which a stale block or a mis-offset slice cannot fake.+ if python3 scripts/test-tui-layout-cache.py zig-out/bin/graff; then :; else+ record_fail tuiguard+ fi# The viewport must not jump when the terminal changes width: drives# TIOCSWINSZ across five widths mid-scroll and reads the screen back. With# the logical scroll anchor removed the marker leaves the screen on the