summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/macos.md23
-rw-r--r--docs/next-daemon.md48
-rw-r--r--docs/typ/building.typ15
-rw-r--r--docs/typ/guide.typ11
-rw-r--r--docs/typ/reference.typ19
5 files changed, 79 insertions, 37 deletions
diff --git a/docs/macos.md b/docs/macos.md
index d767dce2..17294520 100644
--- a/docs/macos.md
+++ b/docs/macos.md
@@ -74,7 +74,7 @@ fourteen are filled in (`src/macos.zig:1761`).
The machine-local half of those methods is no longer this file's. `forkShell`,
`writeFileBytes` and `writeFd` live in `src/host_io.zig` and are shared with
-the tui shell, the SDL shell and the detached daemon; `src/macos.zig` calls
+the tui shell and the SDL shell; `src/macos.zig` calls
them (`:1807`, `:1823`, `:1848`, `:1863`) and its own copies, together with the
four `extern "c"` declarations they needed (`forkpty`, `execv`, `chdir`,
`_exit`), are gone. Two `extern "c"` declarations remain here: `setenv`, and
@@ -1097,17 +1097,16 @@ used for the table and is not folded into the direct-path claim.
- **The `pipe` effect.** Selection filters need `pipeRequest(id)` copied into a
job, a worker to run the command, and a `pipe_resp` event back. Same shape as
`lsp`, one more response type.
-- **Detached sessions.** `Attach` (`SPC s a`) and `Detach` (`SPC s D`) are
- the tui's and the window's alone (`Builtin.enabled` is `pardes.can_attach`);
- were they built here, neither would work. `Detach` emits `Effect.detach`, this
- host fills in no `detach`, and `Pardes.perform` therefore reports
- `error.NotAttached` on the pane's message row (`src/pardes.zig:6837`).
- `Attach` emits `Effect.attach`, which `perform` turns into an `attach_req`
- the shell is supposed to consume from OUTSIDE `pump` with `takeAttach` — and
- `src/macos.zig` never calls `takeAttach`, so the word does nothing at all and
- says nothing either. Wiring it up means a unix-socket frontend loop beside
- the AppKit one, which is `src/detached/client.zig`'s job in the tty and SDL
- shells; see `docs/typ/building.typ`.
+- **Detached sessions.** `Detach` (`SPC s D`), `Adopt` and `Upgrade` are
+ compiled into the tui's and the window's builds alone (`enabled` is
+ `pardes.can_attach`, `src/builtins.zig`), and there is no daemon on macOS
+ (`daemon.supported` is Linux and FreeBSD): this build's session is the one
+ process it started, and closing it ends it. The `Attach` word and
+ `src/detached/` it went through are gone (`docs/next-daemon.md`, "Phase 3
+ notes"); attaching is `pardes attach`, a process of its own. What it would
+ take here is a client: the window build already is one on a Mac
+ (`pardes-gui attach HOST:NAME`), with no daemon on this side; see
+ `docs/typ/running.typ`.
- **IME and marked text.** Only finished characters reach `pardes_key`, so a
dead key composes nothing and Option is Alt rather than a compose modifier.
Real composition means implementing `NSTextInputClient` *and* giving the core
diff --git a/docs/next-daemon.md b/docs/next-daemon.md
index bda6c763..382b3098 100644
--- a/docs/next-daemon.md
+++ b/docs/next-daemon.md
@@ -8,7 +8,13 @@
> snappy.
Designed 2026-10-29 in discussion (the user, the coordinator, a survey
-agent). Nothing here is built yet. Paths are relative to the repo.
+agent), and built since, phase by phase (phases 1 to 6, then the
+architecture steps): each phase's notes below say what was built, and where
+it went otherwise than the design that follows. Where the build differs, the
+design's line is kept and marked *Built otherwise*. What runs today, in the
+words ruled on 2026-11-17 (session, client, far, frontend, detached,
+attach), is the manual's "How pardes runs" (`docs/typ/running.typ`); where
+it goes next is `docs/next-run.md`. Paths are relative to the repo.
## Decided by the user
@@ -29,7 +35,10 @@ agent). Nothing here is built yet. Paths are relative to the repo.
authority and the other clients do not.
- **One long-lived daemon per user per machine.** It supervises one child
process per session, postgres-style. Nothing is left dangling, and the
- core is not de-globalised.
+ core is not de-globalised. *Built otherwise* (Phase 3 notes): the daemon
+ spawns nothing and is nobody's parent; every session registers with it,
+ and it keeps the list of sessions and a dup of each pty master. The user
+ ruled on 2026-11-17 that it stays so.
## What today's seam is, and why it goes
@@ -50,8 +59,13 @@ smallest common grid across them.
- **Processes.**
- The daemon is subreaper, spawner, fd holder, registry and 9P root.
+ *Built otherwise:* fd holder and registry only, and the switchboard of
+ the replica socket; no subreaper, no spawner, no 9P (`src/daemon.zig`
+ "It spawns nothing and is nobody's parent").
- Every session is a child of the daemon: a GUI window, a tty session
- behind a stub, or a headless session.
+ behind a stub, or a headless session. *Built otherwise:* none is; a
+ terminal's session is its stub's child (it forks itself off), a window's
+ or a `--detach` one is the process that was started.
- A session is always an in-process authority with its own local view,
so the regular path does not change. Replicas exist only for extra
clients or remote ones.
@@ -61,11 +75,17 @@ smallest common grid across them.
- The session child drives that fd directly. The stub forwards SIGWINCH
and exits with the session's status.
- Detach: the session drops the fd and the stub exits. No fork happens.
+
+ *Built otherwise:* `pardes` in a terminal forks its session off itself
+ and stays as its stub (`daemon.forkSession`); the stub forwards WINCH,
+ TERM, INT, QUIT and HUP. Only `pardes --attach` passes a terminal's fd,
+ through the daemon, to a detached session.
- **GUI detach.** The window is destroyed and the process carries on
headless. Closing a window that has no other client attached quits it.
- **Shells survive a session crash.** After each `forkShell`, the session
sends the daemon a dup of the pty master, so the shells do not get
- SIGHUP. Being subreaper only decides who reaps them.
+ SIGHUP. Being subreaper only decides who reaps them. *Built otherwise:*
+ the daemon is no subreaper; init (or `systemd --user`) reaps them.
- **The recorder.** It is null when no client is attached. When one is,
it appends what the authority consumed, in order:
- every step's host tape (the results of the ~30 `turn.yield()` sites);
@@ -101,11 +121,14 @@ smallest common grid across them.
- The authority never rolls back.
- **Join.** The authority forks a writer child at a step boundary; the
child streams the dump. The authority buffers the events after it for
- the joiner.
+ the joiner. *Built otherwise* (Still open, 5): no fork; the step dumps the
+ state and a writer thread streams the texts.
- **Remote.**
- - `ssh -L` of the daemon's one socket.
+ - `ssh -L` of the daemon's one socket. *Built otherwise:* of its second
+ socket, `pardes-replica.sock`, a stream socket beside the daemon's own.
- The daemon hands a replication connection's socket to its session.
- - A remote daemon mounts as `/n/<host>`.
+ - A remote daemon mounts as `/n/<host>`. *Not built* (Phase 6: 9P round
+ trips notes): the daemon serves no 9P.
## Determinism leaks (the survey's census)
@@ -3583,7 +3606,11 @@ Not done, and why:
owes (an image's, a PDF's lane) waits for its unit; a local window's
paint-ahead is the core's, which a client's moves only by units.
- **No glide in a client, and a touchpad's fractions round to rows** (the
- core's clock is the session's there, above).
+ core's clock is the session's there, above). *Built since:* a
+ touchpad's fractions are the client window's own picture, and only its
+ whole rows go to the session (`gui.zig`, the test "detached trackpad
+ scrolling keeps fractions local and queues whole rows for replication");
+ a wheel's notch is still whole rows with no glide.
- **The notice a client gets is in its title and its log, not its frame**
(the session's words: joined again, let go, refused). The tty's draws
them on its notice band, which the window's frame has no slot for
@@ -3592,7 +3619,10 @@ Not done, and why:
session's `Font`, `Fonts` and `WindowOpacity` move the session's own
window, and a client's follows them only through its core (the scene
effects do; the font does not). `Fonts` reads the machine's font
- directories untaped, so its list is the session machine's.
+ directories untaped, so its list is the session machine's. *Built
+ since:* a client follows the session's font request by the face's name,
+ when that face is installed on the client's machine (`gui.zig`
+ `syncReplicaFont`); its opacity is still its own.
- **An EffectCode's sources differ by backend** (Vulkan or GL): a client of
another build's window reads the session's.
- **A terminal's client draws a window session's pictures as cells**, never
diff --git a/docs/typ/building.typ b/docs/typ/building.typ
index 6b0e812a..9026aa4f 100644
--- a/docs/typ/building.typ
+++ b/docs/typ/building.typ
@@ -344,14 +344,17 @@ own process, ended by its hangup.
A replica (a client running its own copy of the core, phase 5 of
`docs/next-daemon.md`) connects to `pardes-replica.sock`, a stream socket
beside it that `ssh -L` can forward. `src/wire.zig` is its
-protocol (version 14): fixed-width little-endian fields, a 5-byte header
+protocol (its `version`): fixed-width little-endian fields, a 5-byte header
(tag, then a u32 length), the hello, a ping, the input events. The hello
names a session and carries the client's semantics hash (the protocol,
-release, commit, platform, build options and every dependency's hash); the
-daemon refuses another build's, or a session nobody has, in words, and
-hands an accepted connection to its session (`SCM_RIGHTS`), which welcomes
-it and from then on is the one it talks to. Today the session answers
-pings and nothing more.
+release, commit, build options, every dependency's hash and the tape's
+shape; the terminal's build and the window's share one, so either joins
+the other's sessions); the daemon refuses another build's, or a session
+nobody has, in words, and hands an accepted connection to its session
+(`SCM_RIGHTS`), which welcomes it and from then on is the one it talks
+to: the session sends the dump the client loads, then each step's tape and
+its terminals' screens, and the client sends its inputs
+(`src/replica.zig`; #doc("running") draws it).
#word("Upgrade") (`src/upgrade.zig`) execs the path the session was started
from, at a step boundary, after asking it `--version`: the session's dump
diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ
index 6a50eef1..c78b8149 100644
--- a/docs/typ/guide.typ
+++ b/docs/typ/guide.typ
@@ -360,7 +360,9 @@ pardes --kill=work end it and its shells (--kill-all: every one)
#word("Detach") (#key("SPC s D")) lets the terminal or the window go and
leaves the session running, its panes, shells and files kept; so does a
-terminal that closes. `pardes --attach` takes it back in any terminal,
+terminal that closes, while the daemon (below) is there. A window that
+closes ends its session, unless the session has clients.
+`pardes --attach` takes it back in any terminal,
`pardes-gui --attach` a window session's window: a terminal session takes
a terminal, a window session a window. Attached already, it takes another
view: each terminal or window has its own columns, focus, cursors and
@@ -369,8 +371,11 @@ two takes the size of the one that last typed into it. #word("Detach") in
one lets only that one go. A session is named by `--9p=` or
`--detach=`, else its pid. A session killed outright leaves its shells
running; #word("Adopt") in another takes them in as terminal panes, what
-they showed gone. One `pardes --daemon` per user keeps all of it, and
-leaves once nothing is kept. After a rebuild, #word("Upgrade")
+they showed gone. One `pardes --daemon` per user lists the sessions and
+holds their shells' terminals open; the first session starts it, it is
+nobody's parent, and it leaves once it holds nothing. Which processes
+run, and what survives what, is in #doc("running").
+After a rebuild, #word("Upgrade")
(#key("SPC s U")) moves a running session onto the pardes now installed
where it was started from, in place: its text and undo, its views, its
terminals with their running shells, and its terminals and windows come
diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ
index db4f9c77..dff79859 100644
--- a/docs/typ/reference.typ
+++ b/docs/typ/reference.typ
@@ -1010,8 +1010,10 @@ at 200, ending in `…`. Control characters become spaces.
(#doc("building", section: "listeners")).
- #file("/sessions"): what the pardes daemon keeps, as `pardes --ps`
shows it, a record a line: `daemon <pid>`, then `session <pid> tty|gui
- attached|detached <name>` with a `shell <pid>` line for each shell it
- holds, then `orphan <pid>` for each shell no session holds. Any of the
+ attached|detached <name>` (attached: it has a terminal or window of its
+ own) with a `client <pid>` line for each of its clients and a
+ `shell <pid>` line for each shell it holds, then `orphan <pid>` for each
+ shell no session holds. Any of the
names attaches (`pardes --attach=<name>`, either kind). Read fails `no
pardes daemon answers` with none, or one too old to list (Upgrade it).
- #file("/os/"): existing regular files take read, write and truncation to
@@ -1339,11 +1341,14 @@ to its end before the write is answered, and one that finds nothing fails,
each says so and exits 1. Bare `--detach` names the session after its pid; bare
`--attach` needs exactly one detached session of its kind (a terminal's
for `pardes`, a window's for `pardes-gui`), or with none detached the
- only session of that kind; a second `--detach=NAME`
+ only session of that kind, joined as a client (with none of that kind,
+ the only session there is); 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 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
+ the other kind is, and one on another machine (`--attach=HOST:NAME`, over
+ `ssh -L`; `--attach=SOCKET:NAME` through a socket forwarded already): its
+ own process, listed under the session by `--ps`, up to three clients
+ (four views at once, the session's own among them): 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
@@ -1352,8 +1357,8 @@ to its end before the write is answered, and one that finds nothing fails,
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
- the replicated clients (docs/next-daemon.md, phase 5).
+ as CSI 14, 16 and 18 t do. Each way of running, and what survives
+ what: #doc("running").
- *Config.* The startup file is `$XDG_CONFIG_HOME/pardes/init` when that is
absolute, else `~/.config/pardes/init` (macOS:
`~/Library/Application Support/pardes/init`). A line that fails is a