From 4c2125ecf47588d33f9894c1fdf2833d0512f3b4 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 03:20:04 -0300 Subject: client #2, one frontend a session: the daemon answers `other ` for an attach to a session attached already (as it did for one of the other kind), so a second `pardes --attach` or `pardes-gui --attach` on this machine is a replica client through the replica socket, the path a remote one takes; a session tells the daemon its clients (SO_PEERCRED on each replica socket, at every join and leave) and `--ps` lists `client ` under it; the tty's per-terminal Screens (Screen.create/drop/destroy, primary, its stub and Killed slot), the Poster and its `from` input, the Gui's window-fields swap (window_fields, GuiWindow, copyWindow, freshWindow, follow, route, openAnotherWindow, closeView, windowsOpen, closeOtherWindows, resumeWindows), drawOthers and every harness's extra terminals (snapshot.zig's `start ... views=N` and `view `, e2e_harness's initView and drainOthers, PARDES_TEST_VIEWS in both frontends, the GUI feed's `view;`, the monkey's --views) go; the pump draws the one view this process shows (views.shown), through drawOne when a client's input was the last; an Upgrade from a build that kept a second terminal of its own lets it go (its stub told it is detached) and closes its view; deleted: views.snap, views-term.snap and views-pan.snap with their goldens (the in-process second terminal they drove is gone; views.zig's unit tests keep the per-view cursor, layout, register, sizing, closing and panning behaviour, test/replicas.zig and the soak the views of clients); the two views.zig tests that drew through drawOthers draw through drawOne; daemon.py's second terminal is a client listed by --ps, typed into in both terminals, detached from inside and closed; its second window a client listed by --ps and closed; the reference and next-daemon.md say so; no golden changes; gates: core-test 956/956 both, behaviour-test 248/248 both, unit-test 1487/1488 tui and 1530/1531 gui, pane-test 171/172 both, snap all 102 ok, process-test 0 of 37 failed on both, hxdiff 19 and hxparity 6 mismatches (the base's names), hxgolf 0, replicas, addon-test, gui-golden and monkey-gui 0 of 1 failed, daemon.py main, --window-clients and --gui ok, soak local pass (differ, mispred, view_bad, lost 0) Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/main.zig | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 6f8a9923..623b6033 100644 --- a/src/main.zig +++ b/src/main.zig @@ -100,9 +100,9 @@ const help_text = \\ --attach show the one detached session here (with \\ none, the one session): in this terminal for \\ `pardes`, a window for `pardes-gui`. One - \\ attached already gets another view; one of the - \\ other kind (a window's session in a terminal, - \\ or the reverse) is joined as a client, as + \\ attached already, or of the other kind (a + \\ window's session in a terminal, or the + \\ reverse), is joined as a client, as \\ --attach=:. Returns when the \\ session detaches or ends \\ --attach= ...the session called (its --9p or @@ -117,8 +117,8 @@ const help_text = \\ --attach=: ...through that socket (a path, with a '/'), \\ one forwarded already, or this machine's \\ --ps what the pardes daemon keeps: each session (its - \\ pid, kind, whether attached) and its shells, then - \\ the shells no session holds + \\ pid, kind, whether attached), its clients and its + \\ shells, then the shells no session holds \\ --kill= end session and its shells (TERM, then \\ KILL 2 s later); unsaved changes are lost \\ --kill-all end every session and every shell the daemon keeps @@ -858,6 +858,8 @@ fn manage(io: std.Io, verb: []const u8, name: []const u8) noreturn { const kind = it.next() orelse ""; const state = it.next() orelse ""; w.print(" session {s} {s} ({s}, {s})\n", .{ std.mem.trim(u8, it.rest(), " "), pid, kind, state }) catch break; + } else if (std.mem.eql(u8, what, "client")) { + w.print(" client {s} {s}\n", .{ pid, comm }) catch break; } else if (std.mem.eql(u8, what, "shell")) { w.print(" shell {s} {s}\n", .{ pid, comm }) catch break; } else if (std.mem.eql(u8, what, "orphan")) { @@ -1023,8 +1025,8 @@ fn remoteAttach(init: std.process.Init, opts: pardes.Options, where: []const u8, /// the daemon) to the detached session of that name, or the only one, and /// this process its stub until the session leaves it. `pardes-gui /// --attach`: the session asked to open its window again, and done. A -/// session of the other kind is joined as a replica client, through this -/// machine's replica socket. +/// session attached already, or of the other kind, is joined as a replica +/// client, through this machine's replica socket. fn attachTo(init: std.process.Init, opts: pardes.Options, name: []const u8) noreturn { const io = init.io; var words: [600]u8 = undefined; @@ -1057,7 +1059,8 @@ fn attachTo(init: std.process.Init, opts: pardes.Options, name: []const u8) nore } } -/// A session of the other kind (`--attach`'s): a replica client of it here. +/// A session attached already or of the other kind (`--attach`'s): a +/// replica client of it here. fn crossAttach(init: std.process.Init, opts: pardes.Options, name: []const u8) noreturn { var sock_buf: [ninep_io.sun_path_len:0]u8 = undefined; const sock = daemon.replicaSocket(&sock_buf) orelse die(init.io, "--attach: no runtime directory for the replica socket", .{}); -- cgit v1.3