From 11f380f6d7222f2cad93c2cdf13701ea1f903d47 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 26 Aug 2026 13:27:46 -0300 Subject: One core behind N frontends, the board's own runner moved in, and every board cap on one screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## The wire is the effect stream, not a new protocol `pardes --detach` leaves a core running with no terminal; `pardes --attach` is a frontend that owns a terminal and a socket and nothing else. N frontends on one core all look at the same screen — `screen -x`, not N sessions. The codec (`src/detached/wire.zig`) carries exactly one `Event` or one `Host.VTable` call per message. That is not a coincidence and it is why there is no third vocabulary to keep in step: the core's IO seam was already a struct of function pointers with plain-data arguments, so a socket is a legal implementation of it. `nested.zig`'s socket could not be reused — it carries a builtin command line, and a command line cannot carry a frame. ARCHITECTURE-NEUTRAL on purpose, not as decoration. The frontend on the far end may be riscv32-freestanding on the ESP32-P4 while the core is x86_64 Linux, so every field is an explicit little-endian fixed width and no message is a blit of a native struct. A protocol that only works between two builds of the same compiler would have thrown away the one frontend that motivated it. ## The board comes in; its toolchain stays out `src/p4.zig` becomes `src/esp32p4.zig`, and the pardes half of `../05-zig-p4` — the vaxis-over- serial runner, the UART editor terminal, the keystroke rescue ring, the on-die test suite — moves into `src/esp32p4/`. `build.zig.zon` gains `.zig_p4 = .{ .path = "../05-zig-p4" }`, so `zig build -Dplatform=esp32p4 -Desp32p4-firmware` builds, flashes, monitors and self-tests the board from this repo's `build.zig`. The DIVISION is the point. What moved is what only pardes wants: the runner that drives a pardes core over a serial line. What stayed is everything a second project would also want — the HAL, the register/radio/oracle layers, the linker script, `_start`. `zig_p4` declares no dependencies of its own and its `build()` early-returns when it is not the root package, so this costs the package graph exactly zero packages and the editor's own builds nothing at all. ## limits.zig: nine forgettable places become one budget Nine `platform == .esp32p4` capacity tests lived in nine files. They were never nine decisions — they are ONE decision, how much memory this build may spend, taken nine times where no reader could see the total. `src/limits.zig` puts the whole budget on one screen with every cap named against what it is measured against, derived from two booleans. The payoff is testability on a machine that is not the board: the caps are ordinary comptime values, so a host build can be compiled against the board's numbers and the parking, eviction and clamping paths a 240 KiB core takes get exercised by the normal test suite instead of only over a UART. ## A bare `zig build` `zig build` with no arguments now builds the tty and GUI binaries and installs them into `~/.local/bin`, and says so once on stdout with the flag that overrides it. The old default built one binary into `zig-out` — a path nothing on a `PATH` ever looks at, which made "build it" and "use it" two different commands for no reason. --- src/runtime_config.zig | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/runtime_config.zig') diff --git a/src/runtime_config.zig b/src/runtime_config.zig index bd1ba00b..69d2cdfe 100644 --- a/src/runtime_config.zig +++ b/src/runtime_config.zig @@ -4,22 +4,7 @@ //! data it mutates and the Config report reads. Neither contains callbacks. const std = @import("std"); const panel_animation = @import("panel_animation.zig"); - -/// HOW LONG A HOST-SUPPLIED ABSOLUTE PATH MAY BE, and the only reason this -/// record was ever kilobytes: the shell a native host resolved, the font file -/// a native picker returned, and (in pardes.zig) the one watched theme file. -/// All three name something on a FILESYSTEM, and all three are retained -/// inline because the core has no allocator at the point they arrive. -/// -/// Fixed at 4095 wherever a filesystem exists — deliberately NOT derived from -/// std.fs PATH_MAX, which web has no answer for, and 4095 rather than 4096 so -/// the macOS C bridge's NUL fits without a second, subtly different limit at -/// that boundary. Zero on the P4 firmware, which has no filesystem, no -/// processes to spawn a shell for and no font picker: `Text(0)` is a -/// zero-sized field whose `set` refuses every non-empty path, so the three -/// producers report failure instead of storing 12 KiB nothing can fill. -pub const host_path_cap: usize = - if (@import("pardes_config").platform == .p4) 0 else 4095; +const limits = @import("limits.zig"); /// Tagline glyphs retain body-cell geometry, so allowing a face larger than /// the body would clip into neighbouring cells. Zero would make the role @@ -64,15 +49,15 @@ pub const State = struct { shell: struct { requested: Text(255) = .{}, // One data schema across native, browser and freestanding builds; only - // its one absolute-path field follows `host_path_cap`. - effective: Text(host_path_cap) = .{}, + // its one absolute-path field follows `limits.host_path_cap`. + effective: Text(limits.host_path_cap) = .{}, pending: bool = true, } = .{}, /// The shell acknowledges a font before `effective` changes. A rejected /// request therefore remains queryable without claiming it is on screen. font: struct { - requested_path: Text(host_path_cap) = .{}, + requested_path: Text(limits.host_path_cap) = .{}, requested_name: Text(255) = .{}, effective_name: Text(255) = .{}, pending: bool = false, -- cgit v1.3