--- name: pardes-9p description: Inspect and drive a running Pardes editor through its 9P control filesystem, or exercise its panes, builtins, terminal input and rendered output in an isolated session. Use for Pardes interaction, plugin development and end-to-end debugging. --- # Pardes over 9P Pardes is files: `cat`, `echo >`, `ls` and shell scripts are the whole interface. The recipes are in the Scripting chapter ([docs/typ/scripting.typ](../../../docs/typ/scripting.typ)), every file's semantics in the Reference chapter ([docs/typ/reference.typ](../../../docs/typ/reference.typ)), and a running session serves a summary at `$m/README`. Paths are relative to the repository root. ## Find the session ```sh m=${PARDES_MOUNT:-} [ -n "$m" ] || echo 'no mount: use 9p -a "unix!$PARDES_9P" read index' cat "$m/index" ``` Under `9ns --mntgen` every pane gets `$PARDES_MOUNT`, its session as a directory (also in a `Tty9p` shell). `$PARDES_9P` is the session socket of the pane you run in, `$PARDES_PANE` that pane's serial. A dead session's entry answers `Input/output error`: name the session, never glob. Without a mount, plan9port's `9p -a "unix!$PARDES_9P"` works, and `test/ninep.py` in the source tree (Reference, "Other ways in"). ## Traps - A refused write says only `Invalid argument` or `Input/output error`; `grep '^err' $m/log | tail -1` says why. Not the log's last line: after a refused Del, Exit or Restore that may be `+Unsaved`'s `new`. - Work through a pane of your own (`n=$(cat $m/pane/new)`) and its own `look` and `exec`: the root's act at the pane with the keyboard, which another client, an idle shell or an event helper may own. - `head` on `index`, `layout`, `log` or `recent` through 9ns says `Illegal seek`: use `sed -n 1p`. In `index`, `term` is a shell, `cmd` a command's pane. - `addr` is the pane's and moves on: each `/re/` searches from the last address, and a `data` write leaves it just past the text. Write `addr` before each replacement; a failed address leaves none. - An Edit `x` that matches nothing succeeds: check the text afterwards. - Each open of `pane/new` makes a pane: read it once. - Through a mount, `printf 'a\nb\n' > ctl` arrives one write per line: send a block as one write (`cat block > $p/ctl`), ending in a newline. - Pane words (`Save`, `Undo`, `Del`) go to `pane//ctl`, settings and session words to `$m/ctl`. - `Exit`, `Restore`, `Del` and `get` refuse once over unsaved text. - Never experiment on a session someone is using: strip every `PARDES_*` variable and start your own (Scripting, "An isolated session"); build with `-Dplatform=tty`, since a bare `zig build` installs over `~/.local/bin`.