From e9b4f0e1c37c5c1f369d152d0a70b672433c94b5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 00:02:06 -0300 Subject: kinds #3, addons: src/Addon.zig loads a library that brings a kind (each *.so of $XDG_DATA_HOME/pardes/addons, then /lib/pardes/addons at start; `Addon load `, `Addon unload ` refused while a pane of the kind is open, `Addon reload `; bare, the kinds here), from a copy of its bytes in a memfd so a reload is the file as it is now, its BLAKE3 kept; a load is marked on disk while it runs and a start that finds the mark skips that library until `Addon load` asks again; the crash record says `in addon , `; Kind.zig checks a head before taking it (size, ABI major, a paint, a name, words, leader paths and extensions none else has, the core's or another addon's: refused whole, in words; ctl with words; jobs paired), and a reload checks the new library beside the old (the old kind's own names looked past), opens every pane of the kind again in a fresh arena from the old state's dump and the new load (or its place and its words' last values), and only then swaps, dropping the old library's jobs; any failure says why and leaves the old one running; /addons lists ` static|loaded|refused: why`; the tail: an addon's words join /commands and Help marked `(addon )`, run from exec, a ctl and a leader path after the core's, a word that opens its kind opens a pane of it from anywhere and any other goes to a pane of its kind, its ctl read ends with the kind's fields, its body is the kind's text over 9P, its keys (all but Esc, as a raw terminal's) and clicks go to it, a 9P request steps its ticks and jobs as an event does; the dump record keeps the words' last values; the size of every record is asserted in the header and seen again from Kind.zig; pa_api gains `seed` (a number the same for a pane on every machine, for a game's board), and a zero cell is an unpainted one (PA_PAINTED, which pa_put sets), so a window is cleared by one memset; the hook in the settings agent's files is one arm each: exec.zig executeBuiltinLine's miss goes to Kind.runLine, builtins.zig gains the Addon word, config.zig its leader path (none); the tree gains /addons (README and reference.typ's tree, and an Addons section), builtins-.json the Addon row; no golden changes; tests: a crash mark skipped at two starts and cleared by a load (Addon.zig), the tree listing tests (tree.zig and the process suite's) with /addons; the README keeps its 45 lines Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- docs/typ/reference.typ | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'docs/typ/reference.typ') diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 72d0b5ee..205b0400 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -34,6 +34,7 @@ ctl settings and session builtins @ro commands every builtin, one a line @other-files recent files opened lately: open|closed @other-files dumps the dumps the state file keeps: label date size panes @other-files +addons the kinds of pane here, compiled in or an addon's @addons layout a line per column, then active @columns-and-tags tag the workspace tag @columns-and-tags tagexec a word clicked in the workspace tag @columns-and-tags @@ -970,6 +971,49 @@ at 200, ending in `…`. Control characters become spaces. synthetic. Linux v9fs's truncation `mtime` hint is accepted and dropped. - #file("/src/") with `-Dembed-sources=true`. += Addons + +An addon is a shared library that brings one kind of pane: a picture, a +game, a plot. It is written against one header, `src/kinds/pardes_addon.h`, +in C or anything that speaks C, and links nothing of pardes: the records +are the header's, and what pardes does for it (an allocation from the +pane's arena, a job off the loop, a Look, a message, a new text pane) it is +handed at load. `addons/fake/fake.c` uses every function; a kind with only +a head and `paint` is a valid one. Image is a kind compiled in, through the +same records. + +- #word("Addon") `load ` (relative to the pane's directory) loads + one; `unload ` lets one go, refused while a pane of its kind is + open; `reload ` loads its library again, every pane of the kind + kept through its `dump` and `load` (one with none comes back fresh), and + a library that fails any check leaves the old one running; bare, it says + the kinds here. At start, every `*.so` of `$XDG_DATA_HOME/pardes/addons`, + then of `/lib/pardes/addons`, is loaded. +- #file("/addons"): a line a kind, ` static|loaded + `, and a line an addon refused, with why: another ABI's major, no + `pardes_addon`, a word, leader path or extension already someone's (the + core's or another addon's: refused whole), words with no `ctl`. +- Its words join #file("/commands") and Help, `(addon )` after each. + Written to a pane of its kind they go to that kind; a word that opens its + kind opens a pane of it from anywhere, its argument the path; any other + elsewhere is refused. A Look of a file whose extension an addon claims + opens a pane of its kind. +- A pane of an addon's kind takes every key but #key("Esc") when its kind + takes keys, as a raw terminal does, and its clicks when it takes the + mouse. Its #file("body") is the kind's text, if it has any; its + #file("ctl") read ends with the kind's own fields. +- A dump keeps each such pane: its kind, version, path and place, and the + kind's own record. Restored without its addon, the pane waits in its + place saying `addon is not loaded: Addon load `; + the addon loaded, it opens there. +- An addon runs in pardes's process. A load is marked on disk while it + runs; a start that finds the mark of one that never finished skips that + library, listed so, until #word("Addon") `load` asks for it again. A + crash inside one says `in addon , ` in the crash record. +- `pardes --addon-test