diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 05:58:08 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 08:25:31 -0300 |
| commit | ae3b9e9d19492c827f257da8a224a19d77de51c1 (patch) | |
| tree | a0db7ab1a8e97e56b72a57b8e37910bc10417331 /abi/wire.zig | |
| parent | 32ac0d9d5f7de60f2045edbd1c15631306bd25d4 (diff) | |
| download | pardes-ae3b9e9d19492c827f257da8a224a19d77de51c1.tar.gz pardes-ae3b9e9d19492c827f257da8a224a19d77de51c1.zip | |
last word: a session's last frame on a link says which of two things happened (wire `ended CODE` 0x0b and `left NAME` 0x0c, working names): a Detach typed in a client queues `left` and lets its writer end after it (Peers.detach, Peer.last), a session's end tells every client `ended` with its code before the links are let go (Peers.ended, from runtime/session.zig after the loop; refuseAll and it share the 200 ms flush); a client that typed Detach prints "pardes: detached from 'NAME', which is still running; come back with `pardes attach NAME`" and exits 0 again (the attach's regression to exit 1 and "let this client go" undone, for every client, no variable), a client whose session ended exits with the session's code quietly, a pair's client after reaping its session (EDITOR=pardes waits for the session's end); client.Ended a union (left, ended CODE); a Detach with no daemon is refused in a client too (tui.zig `detach`: the daemon checked first), since a pair with none ends with its last link; test/daemon.py: the client Detach expectations (0 and the line), a session's Exit (0, no let-go line), `pair` Exit 0 and the session reaped, `pair_rows` the rows of the design's tables 1.1 and 2.2 B (Detach said, exit 0, the session listed; a client ended by TERM with its terminal put back, by KILL and by its terminal's HUP: the session runs on; no daemon: Detach refused, the terminal closed ends the session; nothing left); docs/next-run.md and core/CHANGELOG.md say so (the CHANGELOG's `new --detach` line is the first change's); `kept` NOT built: no terminal behaviour turns on it while a hangup and a killed client are losses and Exit ends the session (see the report)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'abi/wire.zig')
| -rw-r--r-- | abi/wire.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/abi/wire.zig b/abi/wire.zig index 1f7d02d2..7ef5da90 100644 --- a/abi/wire.zig +++ b/abi/wire.zig @@ -191,6 +191,10 @@ pub const ServerTag = enum(u8) { /// unit naming it: the hash, the whole's length and this piece's place /// (u64le each), then at most 1 MiB of it (core/replica.zig). blob = 0x0a, + /// The session's last word on a link: it ended, with its exit code. + ended = 0x0b, + /// ...or this client left it running (a Detach typed in it): its name. + left = 0x0c, }; pub const ServerMsg = union(ServerTag) { @@ -208,6 +212,8 @@ pub const ServerMsg = union(ServerTag) { blobs: []const u8, zstd: []const u8, blob: []const u8, + ended: u8, + left: []const u8, }; /// A message's header, for a payload sent on its own (a unit, a dump's @@ -243,6 +249,8 @@ pub fn decodeServer(tag: u8, payload: []const u8) Error!ServerMsg { .blobs => return .{ .blobs = payload }, .zstd => return .{ .zstd = payload }, .blob => return .{ .blob = payload }, + .ended => .{ .ended = try r.takeByte() }, + .left => .{ .left = try r.take(try r.takeInt(u16, .little)) }, }; try end(&r); return msg; @@ -267,6 +275,8 @@ pub fn encodeServer(out: []u8, msg: ServerMsg) Error![]const u8 { .pong => |v| try w.writeInt(u64, v, .little), .dump, .unit, .screen, .blobs, .zstd, .blob => |bytes| try w.writeAll(bytes), .check => |v| try w.writeInt(u64, v, .little), + .ended => |code| try w.writeByte(code), + .left => |name| try putSlice16(&w, name), } try finishMessage(&w, at); return w.buffered(); |
