summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 03:20:04 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:13:33 -0300
commit4c2125ecf47588d33f9894c1fdf2833d0512f3b4 (patch)
treec76510fd390e20187554ea86a3fdabd2dfb65ca5 /docs
parentd1d5d3cfb18841604bba2057eeb3598f729b4475 (diff)
downloadpardes-4c2125ecf47588d33f9894c1fdf2833d0512f3b4.tar.gz
pardes-4c2125ecf47588d33f9894c1fdf2833d0512f3b4.zip
client #2, one frontend a session: the daemon answers `other <name>` 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 <pid> <command>` 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 <k>`, e2e_harness's initView and drainOthers, PARDES_TEST_VIEWS in both frontends, the GUI feed's `view;<k>`, 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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'docs')
-rw-r--r--docs/next-daemon.md50
-rw-r--r--docs/typ/reference.typ18
2 files changed, 60 insertions, 8 deletions
diff --git a/docs/next-daemon.md b/docs/next-daemon.md
index 5a4b939a..014118ef 100644
--- a/docs/next-daemon.md
+++ b/docs/next-daemon.md
@@ -281,6 +281,10 @@ child; `std.posix.tcgetattr` (an ioctl on that layout) is the right one.
## Phase 4 notes
+(Superseded by "Architecture step 5 notes" below: the session's share of
+a view is indexed now, and a second local terminal or window is a replica
+client; the in-process extra views described here are gone.)
+
Built 2026-10-29 (`src/views.zig`, the tty and GUI hosts, `daemon.zig`,
the snapshot harness and the monkey). Decisions taken at the forks, with
the ponytail lens:
@@ -4598,3 +4602,49 @@ the journal made redundant. What landed, and what did not and why:
the other: 0.86-1.04 ms of the step (the first 2.9) where it was 5.0-6.0,
and a client's input step p50 0.32 ms where it was 2.46: a unit's digest
no longer hashes the edited file.
+
+## Architecture step 5 notes: one client path
+
+Done 2026-11-06 (the `client` line, §9.4 step 5 of the clean-room
+architecture). A session shows one frontend of its own; every further view
+is a replica client.
+
+- **The views indexed.** A view's share of the session is `Pardes.View`
+ (the ~42 fields `views.fields` used to name), one of `Pardes.views[4]`
+ (null while closed), the live one `views[live]` through `Pardes.view()`.
+ Going into another view is the index; nothing of the session's is copied.
+ The references were rewritten from the compiler's errors (`p.active` is
+ `p.view().active`, with `const v = p.view()` hoisted where a function uses
+ it three times or more). The views are in the digest (a closed one is
+ null, so a dump and a digest pay for the open ones only); a pane closing
+ leaves every view's layout at once (`views.gone`), where each parked view
+ used to keep serials and prune on its way back. An image from before
+ (the live view as the core's own fields, the others under `views`) loads
+ into `views[]` once.
+- **What stayed swapped.** Each view's share of a pane (`PaneView`: focus,
+ weights, fold, the body's cursor, ranges, mode, a document's scroll and
+ size, the step's tag rows and bands) is still the pane's own fields for
+ the live view and `Pane.pv[k]` for the others, parked and unparked as
+ before, and still out of the digest. Indexing it as the session's share
+ was measured and not done: `pane.body` alone is 1,340 references, the
+ body is a `Text` whose methods serve tags too, a document's scroll lives
+ in `File.State` (102 references behind a `*State`), and a document's
+ `cols`/`rows` share their 600 references with a terminal's pty size, which
+ every view shows; none of the pane code has the live index to hand.
+- **One frontend a session.** The daemon answers `other <name>` for an
+ attach to a session that is attached already (as it did for one of the
+ other kind), so the second `pardes --attach` or `pardes-gui --attach` on
+ this machine is a replica client through the replica socket, as a remote
+ one is. The tty's per-terminal `Screen`s, the `Poster` and its `from`
+ input, the Gui's window-fields swap (`window_fields`, `GuiWindow`,
+ `follow`, `route`, `openAnotherWindow`, `closeOtherWindows`), the pump's
+ `drawOthers` and the harnesses' extra terminals (`start ... views=N`,
+ `view <k>`, PARDES_TEST_VIEWS, the GUI feed's `view;<k>`, the monkey's
+ `--views`) are gone. The pump draws the one view this process shows
+ (`views.shown`: open, no client's, kept for none), through `drawOne` when
+ a client's input was the last.
+- **`--ps`.** A session tells the daemon its clients' pids (SO_PEERCRED on
+ each replica socket; 0 where it is not Linux) whenever one joins or
+ leaves; `--ps` lists `client <pid> <command>` under its session.
+- **An Upgrade from an older build** with a second terminal of its own lets
+ that terminal go, its stub told it is detached; the view closes.
diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ
index 972d5794..be157082 100644
--- a/docs/typ/reference.typ
+++ b/docs/typ/reference.typ
@@ -1111,7 +1111,7 @@ to its end before the write is answered, and one that finds nothing fails,
`--no-prefix` diff's paths are kept.
- *Sessions.* `pardes --ps` prints what the daemon keeps: each session
(its pid, terminal or window, attached or detached, name) with the pids
- and commands of the shells it holds, then the shells no session holds,
+ and commands of its clients and of the shells it holds, then the shells no session holds,
which #word("Adopt") takes. `--kill=NAME` ends that session and its
shells (a TERM, then a KILL 2 s later; unsaved changes are lost),
`--kill-all` every session and every kept shell; with no daemon running
@@ -1120,13 +1120,15 @@ to its end before the write is answered, and one that finds nothing fails,
for `pardes`, a window's for `pardes-gui`), or with none detached the
only session of that kind; a second `--detach=NAME`
while NAME runs (a plain session is named by its pid) says so in words
- and exits 1. A session attached already takes another view, up to four:
- each terminal or window its own layout, focus, cursors, selections,
- modes, scroll and jumps, over the panes, texts, tags, terminals,
- messages and registers they share. A terminal pane shown in two takes the
- size of the view that typed into it last; a shorter view shows the
- rows down to its cursor, an arrow in the gutter when rows are above. #word("Detach"), or a terminal closing, lets that view go and
- leaves the others. With none
+ and exits 1. A session attached already is joined as a client, as one of
+ the other kind or on another machine is (`--attach=SOCKET:NAME`, its own
+ process, listed under the session by `--ps`), up to four clients: each
+ terminal or window its own layout, focus, cursors, selections, modes,
+ scroll and jumps, over the panes, texts, tags, terminals, messages and
+ registers they share. A terminal pane shown in two takes the size of the
+ view that typed into it last; a shorter view shows the rows down to its
+ cursor, an arrow in the gutter when rows are above. #word("Detach"), or a
+ terminal closing, lets that client go and leaves the others. With none
attached, `size C R` sets the screen, messages clear by the clock, and a
pty reports its size in pixels at the last cell size (8×16 before any),
as CSI 14, 16 and 18 t do. Attaching from another machine is gone until