summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
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