From 05826d5148b8d75c32397380b9f64e0b3477e5bb Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 30 Oct 2026 16:16:25 -0300 Subject: replica: pardes's own steps over a terminal speculated, not every input while one has the keyboard (H14): what reaches its program is a pty write and stops as before; its view (normal-mode keys, the wheel, Ctrl-u) moves here at once, the rollback copy keeping each terminal's view (it holds no emulator) and a delta setting it, put back between the units it replays in the order the deltas came among them; what was applied over a terminal applied again over each delta or rows that come while it waits, and its unit taken at once rather than kept to replay over later deltas; closing a terminal stops (its pty's end is the authority's) Co-Authored-By: Claude Opus 5.5 --- src/tape.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/tape.zig') diff --git a/src/tape.zig b/src/tape.zig index 7b7c02f2..3975681e 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -219,6 +219,9 @@ pub const Tape = struct { /// What stopped it: a host function's or a site's name, or a poison's /// reason (PARDES_REPLICA_STATS counts them). poisoned_by: []const u8 = "", + /// It read a terminal (its rows) or moved one's view: what it did + /// depends on the emulator, which deltas write (`touchTerminal`). + touched: bool = false, /// The allocator of the core a replay makes (a replica's rollback epoch, /// src/rollback.zig), when it is not the tape's own. core_gpa: ?std.mem.Allocator = null, @@ -1009,6 +1012,13 @@ pub fn poison(why: []const u8) void { }; } +/// A speculation read a terminal's rows or moved its view (`Tape.touched`). +pub fn touchTerminal() void { + if (on) |t| if (t.speculating) { + t.touched = true; + }; +} + /// A harmless stand-in for what a host call or a syscall would have /// returned to a speculation that is thrown away once it returns: an /// error where one can be said, else zeroes. @@ -1105,6 +1115,7 @@ pub fn beginSpeculation(t: *Tape) void { t.speculating = true; t.poisoned = false; t.poisoned_by = ""; + t.touched = false; t.no_digest = true; t.buf.clearRetainingCapacity(); t.seeFields(); -- cgit v1.3