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 --- src/Core.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Core.zig') diff --git a/src/Core.zig b/src/Core.zig index 54f0233e..5c68a5af 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -1192,7 +1192,7 @@ pub fn dropPendingWrite(p: *Pardes, id: usize) void { pub fn postEvent(p: *Pardes, ev: Event) void { switch (ev) { .key => |k| std.debug.assert(k.text.len == 0), - .output, .paste, .lsp_resp, .pipe_resp, .search, .file_changed, .command => unreachable, + .output, .paste, .lsp_resp, .pipe_resp, .search, .file_changed, .command, .addon => unreachable, else => {}, } if (p.in_len == p.in_q.len) return; @@ -1483,6 +1483,7 @@ pub fn serveFs(p: *Pardes, req: ctlfs.Req) ctlfs.Reply { // step does: the cursor and scroll reconciled, the scripted panes // told, and the panes it made announced to /log now rather than at // the end of whatever the editor does next. + pardes.Kind.step(p); p.sync(); p.fsReport(); // A /focus write moves the keyboard as a click does: the programs @@ -1622,6 +1623,7 @@ pub fn update(p: *Pardes, ev: Event) void { if (focused) if (p.host.vtable.newer_build) |f| if (f(p.host.ctx)) p.setMessage(p.active, newer_build_words); }, .handed => |h| p.handover.finish(p, h.seq, h.to, h.failure), + .addon => |a| pardes.Kind.landed(p, a.op, a.pane, a.ok, a.text), .frontend => |f| { p.frontend = f; }, -- cgit v1.3