summaryrefslogtreecommitdiff
path: root/abi
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 17:31:13 -0300
committerGabriel Schneider <[email protected]>2026-11-22 02:33:28 -0300
commit245dd088a5b502c72f94c85bf1cc5bd0ba7ebb56 (patch)
tree8772fea20505fb9d5a959bcf2fc646a81c614994 /abi
parent242095c9e7e2eca11af92b9a0d563d640cfa65f2 (diff)
downloadpardes-245dd088a5b502c72f94c85bf1cc5bd0ba7ebb56.tar.gz
pardes-245dd088a5b502c72f94c85bf1cc5bd0ba7ebb56.zip
terminals: every client's terminals by the pty's bytes, the one road (the user's ruling of 2026-11-22: "just start the structural fix"): a session's units carry its ptys' bytes and each client feeds its own emulator in the tape's order (`Peers.bytes`, set by runtime/session.zig unless PARDES_TERM_SCREEN, a working name for the way back until screen state's road is deleted), and the welcome says the road (wire 29: one byte before `blobs`; test/daemon.py `WIRE`), which a client loads its dump on BEFORE its digest check (`fromDump`, join's and confirmBoot's one load, written twice before, and `road`): the pair's switch (`zwrkukrx`, duplicated here) checked a client's dump on screen state and turned it after, so under bytes every `pardes --attach` to a session with a terminal was refused as "loaded as another session" (daemon.py:544 client C, a far client's first frame never drawn); the pair's own boot takes the road from its environment (its session is its child) and the welcome confirms it; the predicted echo stays on the one road: echo.zig's overlay was already drawn over the frame, only its arming (gated on screen state) and its retirement (a delta's version) were the old road's: armed whenever a replica has an echo, retired at each confirmed unit that fed a terminal (`Echo.fed`, the grid's active top), echo.zig's tests run on the bytes road (17/17 under the filter); the pump-lag test (a session's own step reading a terminal right after its output, in one pump, through `Peers`) passes here: there is no flush to be behind; test/process.zig and test/daemon.py keep PARDES_TERM_SCREEN (`KEEP`) for the way back's row; measured against screen state (reports/pardes-term-join-7.md, its table): typing at a far prompt 16 KB against 22 KB, a full-screen program 80 KB against 103 KB, a 1 MiB `cat` through 1 Mbit 607 KB and 5.2 s with one 2.2 s rejoin against 27 KB and 0.4 s, the echo predicted on both (10 ms at 200 ms RTT, 222 ms unpredicted); gated: core-test 904/1068, shell-test 1110/1113, term-test 19/19, process-test 0 of 145 and as pairs 0 of 145, the bytes soak 3 of 3 clean, daemon.py every mode on Debug and ReleaseSafe (--restore the base's), --upgrade from the installed build 3 of 3 and between the two builds both ways, --far whole 7 of 7 on ReleaseSafe, the frame and perf gate against tree3 PASS (77/77, corpus2x -0.053%, 121 counts within 0.1%, client cells within +0.045%), the cross-builds
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'abi')
-rw-r--r--abi/wire.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/abi/wire.zig b/abi/wire.zig
index d7df7bc3..f87131bf 100644
--- a/abi/wire.zig
+++ b/abi/wire.zig
@@ -10,6 +10,10 @@ const pardes = @import("core");
const config = @import("pardes_options");
const build_info = @import("build_info");
+/// 29: a session's terminals reach its clients as the pty's bytes in its
+/// units, each client's emulator its own; a welcome says the road (`bytes`;
+/// screen state under PARDES_TERM_SCREEN), which the client loads its dump
+/// on (replica.fromDump);
/// 28: whether a terminal holds a kitty image is the session's, taped
/// after its output (tape site `images`), and a pane's (Pane.term_images)
/// in its join's dump and its digest: a screen-state client's tag says
@@ -50,7 +54,7 @@ const build_info = @import("build_info");
/// part B); 14: the hello names a session and
/// carries the semantics hash, and a ping is answered (phase 5's
/// groundwork); 13: the frames went (phase 3).
-pub const version: u16 = 28;
+pub const version: u16 = 29;
/// The terminal's build and the window's step alike (`semantics`).
const family = switch (config.platform) {
@@ -223,7 +227,7 @@ pub const ServerMsg = union(ServerTag) {
/// dump that follows is, and the session's offset from UTC (a replica
/// guesses the session's time of day). A far client is told how many
/// blobs the dump holds (`blobs`).
- welcome: struct { pid: u32, session: []const u8, client: u16 = 0, view: pardes.Pardes.View.Id = .at(0), dump_len: u64 = 0, gmtoff: i32 = 0, digest: u64 = 0, semantics: u64 = 0, blobs: u32 = 0 },
+ welcome: struct { pid: u32, session: []const u8, client: u16 = 0, view: pardes.Pardes.View.Id = .at(0), dump_len: u64 = 0, gmtoff: i32 = 0, digest: u64 = 0, semantics: u64 = 0, bytes: bool = false, blobs: u32 = 0 },
refused: []const u8,
pong: u64,
dump: []const u8,
@@ -259,6 +263,7 @@ pub fn decodeServer(tag: u8, payload: []const u8) Error!ServerMsg {
.gmtoff = try r.takeInt(i32, .little),
.digest = try r.takeInt(u64, .little),
.semantics = try r.takeInt(u64, .little),
+ .bytes = try r.takeByte() != 0,
.blobs = try r.takeInt(u32, .little),
} },
.refused => .{ .refused = try r.take(try r.takeInt(u16, .little)) },
@@ -290,6 +295,7 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 {
try w.writeInt(i32, h.gmtoff, .little);
try w.writeInt(u64, h.digest, .little);
try w.writeInt(u64, h.semantics, .little);
+ try w.writeByte(@intFromBool(h.bytes));
try w.writeInt(u32, h.blobs, .little);
},
.refused => |words| try putSlice16(&w, words),
@@ -733,13 +739,14 @@ test "detached wire: every Event variant round-trips" {
try testing.expectEqual(@as(u64, 0xfeed_beef_0000_0001), (try roundClient(&buf, .{ .ping = 0xfeed_beef_0000_0001 })).ping);
{
// The other way: framed the same, its tag the ServerTag's number.
- const bytes = try encodeServer(&buf, .{ .welcome = .{ .pid = 42, .session = "work" } });
+ const bytes = try encodeServer(&buf, .{ .welcome = .{ .pid = 42, .session = "work", .bytes = true } });
const f = (try framed(bytes)).?;
try testing.expectEqual(@as(u8, 0x01), f.tag);
- try testing.expectEqualSlices(u8, &.{ 42, 0, 0, 0, 4, 0, 'w', 'o', 'r', 'k', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, f.payload);
+ try testing.expectEqualSlices(u8, &.{ 42, 0, 0, 0, 4, 0, 'w', 'o', 'r', 'k', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, f.payload);
const back = (try decodeServer(f.tag, f.payload)).welcome;
try testing.expectEqualStrings("work", back.session);
try testing.expectEqual(@as(u32, 42), back.pid);
+ try testing.expect(back.bytes);
try testing.expectEqual(@as(u8, 0x03), (try framed(try encodeServer(&buf, .{ .pong = 7 }))).?.tag);
}