diff options
Diffstat (limited to '.agents')
| -rw-r--r-- | .agents/skills/pardes-9p/SKILL.md | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/.agents/skills/pardes-9p/SKILL.md b/.agents/skills/pardes-9p/SKILL.md index 8903a609..0643e209 100644 --- a/.agents/skills/pardes-9p/SKILL.md +++ b/.agents/skills/pardes-9p/SKILL.md @@ -13,24 +13,29 @@ relative to that root unless linked. ## Find the session through the mount -This machine keeps a FUSE mount of every posted session under `/mnt/9p`: -`/mnt/9p/pardes/<pid>/` is one session's served root. Inside a pane, +Check `$NINE_MOUNT` first. `9ns --mntgen` sets it for every process it starts +(an interactive shell on this machine runs inside one), so a set `$NINE_MOUNT` +means the posted-9P registry is mounted there, usually `/mnt/9p`, and each +running editor is a directory `$NINE_MOUNT/pardes/<pid>/`. Inside a pane, `$PARDES_9P` is that session's socket (`/run/user/1000/pardes-9p-<pid>.sock`), -so its pid is the directory to use, and `$PARDES_PANE` is the calling pane's -serial: +which names the directory, and `$PARDES_PANE` is the calling pane's serial: ```sh -m=/mnt/9p/pardes/$(basename "$PARDES_9P" .sock | sed 's/^pardes-9p-//') +[ -n "$NINE_MOUNT" ] || echo 'no 9P mount: use the Python client below' +s=${PARDES_9P##*/pardes-9p-}; m=$NINE_MOUNT/pardes/${s%.sock} cat "$m/index" cat "$m/pane/$PARDES_PANE/body" ``` +From there the editor is files: `cat`, `echo >`, `ls` and shell scripts are +the whole interface, and nothing below needs more than they do. + Entries for dead sessions stay listed and answer `Input/output error` on any access, so name the session you mean rather than globbing or taking the newest. `cat "$m/index"` is the cheapest liveness check, and `cat "$m/status"` reports the `pid`, `version` and `panes` of a session new enough to serve it. -`/mnt/9p/pardes` is the registry of posted sessions, mounted once for the +`$NINE_MOUNT/pardes` is the registry of posted sessions, mounted once for the machine. It is not the per-pane kernel mount the `Tty9p` builtin makes, which gives one pane's shell `$PARDES_MOUNT`; see [docs/v9fs.md](../../../docs/v9fs.md) for that. Either mountpoint serves the same tree. A `9ns --unix SOCKET -- cmd` @@ -52,6 +57,7 @@ $m/pane/<n>/pty/run write one line, read `exit N` + its output, or `busy` / `e exec 3<>$m/pane/$n/pty/run; echo make >&3; cat <&3 (a fresh terminal: waits for its first prompt; if none comes, interrupt the read) $m/log recent events, then EOF: new|del|rename|save <serial> <name>, msg <serial|-> <text>, + run <serial> <line>, exit <serial> <N|?>, send <from> <to> <repl-id>, dump|restore <path>, err <serial|-> <file>: <why> (exec 3<>$m/log; echo follow >&3; cat <&3 waits for new ones; tail -f does not) $m/screen the rendered screen as JSON, frozen per open @@ -60,7 +66,8 @@ $m/focus the serial of the pane with the keyboard (empty while a column/wor echo a serial into it to move the keyboard (a folded pane stays folded) $m/ctl the settings, one a line as a write takes them; write a setting or a session builtin (Newcol, Dump, Theme x; Exit QUITS the editor, Kill [word...] stops the - commands pardes started (command panes, lines it typed into shells); Exit and Restore refuse once per + commands pardes started (command panes, lines it typed into shells), a word + matching a command line's first word; Exit and Restore refuse once per unsaved pane, `<name>: Modified (Exit again to discard)`, and the same word again DISCARDS that text -- not a retry, unlike lock's `file in use`; Kill signals only the foreground job, so of `sleep 30; echo done` the @@ -119,15 +126,20 @@ the editor, not as a write error, so inspect the resulting pane, index, message or screen; only a malformed line fails the write itself. A word no builtin knows (a typo included) is a command line: written at a terminal at its prompt it is typed into that shell; from anywhere else it runs as a command -pane, a terminal whose child is `$SHELL -c` the line in the pane's -directory, which ends showing `exit N` (a typo: `exit 127`) and logs `run -<serial> <word>` and `exit <serial> <N|?>` -- `exec` reads back its serial, +pane, a terminal whose child is the root ctl's `Shell` (fish unless set) +running `-c` the line in the pane's directory, which ends showing `exit N` (a typo: `exit 127`) and logs `run +<serial> <line>` and `exit <serial> <N|?>` -- `exec` reads back its serial, so follow `log` for the exit. The directory's next command reuses a finished command pane, below what it showed. A terminal bound as a REPL (`Repl python` on its ctl) takes the middle clicks made on a `.py` body instead, but never a 9P write: a script sends code by writing the REPL pane's `pty/data`, and runs a command from such a file with `Exec <text>` or the -tag. Every refused 9P write adds an `err <serial|-> +tag. A bound terminal's `ctl` line ends with its id (`python-a`); an event +record written back from such a file's body goes to its REPL, as the click +would. `Repl -` unbinds; a bare `Repl` says the binding. Multi-line code +written to `pty/data` should be a bracketed paste, `\e[200~<code>\e[201~` +then `\r`: sent line by line, a blank line ends a Python block, and Python +3.14's REPL auto-indents each line it is typed. Every refused 9P write adds an `err <serial|-> <file>: <why>` record to `$m/log`; through a mount the write itself only says `Invalid argument`. @@ -240,8 +252,12 @@ A Restore puts a new editor under every client: the Restore write is answered, then every connection is hung up (their fids name the old editor's panes); dial again, and the new log names the restored panes then `restore <path>` -- the authority, since a slow client may see the cut -before the answer. `Dump` writes `pardes-<date>-<time>.zon` under `DumpDir` -(`~/.local/share/pardes` by default) and logs `dump <path>`. +before the answer. Through a 9ns mount the Restore write itself usually +fails with ECONNRESET although the Restore went ahead: 9ns fails a request +whose reply is already in when the hang-up breaks its next send. Trust the +log. `Dump` writes `pardes-<date>-<time>.zon`, the time in UTC, under +`DumpDir` (`$XDG_DATA_HOME/pardes`, else `~/.local/share/pardes`) and logs +`dump <path>`. Read the event implementation before building an interceptor. Close handles in `finally`, and disconnect after a socket timeout. The service shares four connection slots and 32 screen/terminal-history snapshot handles. |
