| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
| |
rollback epoch, so a delta written under a held copy is no copy's to keep or put back (a ReleaseFast run found the heap corrupted)
terminal.zig: State.gpa, what an emulator and its State are allocated with: the core's, but on a screen-state replica the C heap (emulator_gpa). replica.zig applies deltas and rows with it; the epoch's pause is gone (rollback.zig back to part A's but for the rows cache).
The harness in ReleaseFast corrupted the heap after 20 seeds: a safe build's check named an allocation the copy saved and a delta freed while the epoch was paused, reached as `Text.own` through a view's stale slot (views.zig keeps the live view's parked share as stale copies, and the copy walks it), the replica's old terminal's pin map at that address. With the emulator outside the epoch, nothing of it is saved, kept or put back, and every free under a held copy is put off again, as in part A. Debug, 20 seeds at 80 ms and the defaults: no divergence, every replica and terminal the authority's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
keeps over it taped, the history a step reads sent before its unit, rows sent a blob once a message, and the rows cache out of the rollback copy
terminal.zig, tape.zig: ingestWithPositions tracks its rows only where an ingest happens; what the ingest told them (each tracked row's row after it and whether it was erased, a clear, whether the pages lived, a pin not made) is a taped value (Site.positions), which a screen-state replica, ingesting nothing, takes; the logic after it runs alike on both. On the stack, so the local path allocates nothing new. buildRows marks a terminal read (State.read) outside the render (terminal.drawing).
screen_state.zig, replica.zig: the authority keeps each peer's holes as its replica does (Peer.holes, from the deltas it sent), and Screens.fill sends a peer the rows it lacks of every terminal a step read, after the step and before its unit, so a replay reads what the step read (a text-mode cursor moved into history the flood scrolled past diverged). encodeRows sends each distinct blob once a message and the rows as addresses (a fill after yes is a third). The rows cache is dropped when a copy is taken and emptied when it is put back, not saved.
test/replicas.zig: Ctrl-b in the mix (a shell out of tty mode: text, cursors and selections over it), and a shell's session (prompts, titles, directories, clears) between the TUI and the flood. 4 seeds x 120 inputs x 3 clients at 30, 80, 207 ms: no divergence, every replica and terminal the authority's, 4,653 deltas checked.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
| |
rows the core keeps read of a terminal marked stale after a delta and after a copy is put back, and a test that a delta applied under a speculation outlives its rollback
replica.zig: the core's cache of a terminal's rows (shell_rows) is invalidated by feedOutput, which a replica no longer calls; a delta and fetched rows now mark it, and so does a rollback, whose copy holds whatever rows were read before it was taken (a replica draws between steps). The test types into the text pane, lets the shell print under the held copy, lands its delta, reads the rows, and rolls back: the terminal is the authority's newest, the history as long, the rows the screen's. Without the stale mark it reads an older grid's rows; without the epoch's pause the rollback frees the emulator's pages and it crashes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
trimmed by the thousand (a yes delta applies in 97 us, was 2.4 ms), holes blanked when they come into view, and input into a terminal left to the authority
screen_state.zig: when a delta's scroll is more than the replica's screen and history hold, nothing it holds is in the new state; its rows stay where they are, renumbered, the active ones and the tail written from the delta, the rest holes, and only as many more rows grown as the authority's history is longer. A hole has whatever that row held before, so `blank` clears the holes in view before they are asked for. The bench's floods run under the C allocator, as a replica does.
replica.zig: a replica's input whose live pane is a terminal is not speculated (its step reads the emulator, the last delta's here and the pty's newer one there): it waits for the authority, as a key in tty mode already did at its pty write. ReleaseFast, 200x60 yes at 16 MB/s: apply p50 97 us, p99 284 us; encode a frame 41 us at one peer and at three; 64 KB/s a peer.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
several in flight against the version last sent, its history the authority's to the row, and the authority's own steps batched into a unit a frame
screen_state.zig: each state the authority sends is a version of its terminal (Track), made once for every peer; a peer's delta is against the version it was last sent (the stream is ordered and loses nothing), up to 32 in flight, a peer at the bound waiting for an acknowledgement and then getting the newest; peers at one base are sent the same bytes. A replica refuses a delta against another base and is started afresh. It keeps the authority's history extent to the row (no byte limit of its own, trimmed to the authority's count), takes its viewport and its cursor's semantic content, and grows a flood's rows in bulk. The soak now keeps several in flight, lands them late in order, loses one now and then, and checks the history extent and the viewport too.
replica.zig: Screens (the authority's tracks and peers) and Replica.screen/screenRequest, messages of u8 pane, u32 serial, u8 kind (a delta, rows; an ack, a row request, a reset). Deltas are applied with the replica's epoch paused, so an emulator outlives a rollback. Authority.output/pending: its own steps (a pty's output) go into one unit, sent before any other input it steps and at a frame, with one digest; under screen state a digest is one word.
tape.zig, terminal.zig: under screen state an output is recorded without its bytes, pty writes are off the tape on both sides, no digest covers an emulator, and a replica's core never ingests or resizes one (a resize's own core work, the pointer selections cleared, still runs). A terminal counts its writes (State.changes); its MarkedHandler cycle rides in each delta.
test/replicas.zig: the session's shell runs a TUI, then 8 MB of yes read 4 KB at a time, while three clients type; deltas go out before each input the authority steps and once a frame, acknowledgements and row requests come back over the links, every applied delta is checked against the authority's screen at that version and every terminal at quiescence.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
to its slot after the frame; a headless replica, which draws nothing, kept them and diverged (three-view monkey seeds 5 and 35)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
makes it, and so does the one view a revived session keeps
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
whole and loaded with the room it had, its elements plain numbers or no build
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
88 KB pane, and makes its empty undo history only for a slim record; the notes say what the small close after a big one measures
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
load; a session revived for one client is its live view alone, as view 0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
fixture, -l's help); the touch check resizes a pane by its grip, there being no rule between panes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
theme by its name, a field compiled out passed over, no disk asked; touch.dump replaces the hand-written ZON fixture
Fixed for wasm32-freestanding: counts as usize, no threads, stb_image, tape or
host stat there. touch.mjs follows the renderer's 13 tag-layer fields, helix's
retuned colours and the tag column.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
record and dump
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
and revive, what the design missed); the GUI's Restore test keeps the dump's serial
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
session read by name is tested; nothing of a load goes to stderr
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
session as it was dumped: a terminal's view, its prompts hidden in text mode, a pane's message, typed text over its history
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
Restore, -l, Handover and the store; dump.zig's hand-written schema gone
A dump is walk.zig's walk of the core with a table of every type it reaches
(fields, enum and union names, number widths), read back by name; terminals
are ghostty's snapshot (screens, history, kitty images); a failed load frees
what it made.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
back to a pane, as Shift-Esc does, instead of running Last underneath it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
shows, and with none goes back a pane as Esc does everywhere else; Shift-Esc still goes at once
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
walker copy put back where it was, replicas that apply their own input at once and take the authority's tape as the truth, and a harness of typists over delayed links
src/rollback.zig: the replica core's allocator (`Epoch`) knows every allocation, and while a copy is held puts off frees of what was there before and refuses to grow it in place, so what the core held stays where it was. The copy (`Copy`) is the digest's walk saving the bytes of every allocation it reaches, field by field (the derived caches and this process's own too: a safe build's free writes over what it frees, and the frame arena points at what the epoch then frees), but the queues a step drains and the frame statistics; a file's text, its line index and its undo snapshots are pinned instead (made anew at each edit, never written; now freed raw everywhere), checked unchanged in a safe build. Put back, each allocation's bytes go back over it, the epoch's allocations are freed and its put-off frees forgotten; let go, they are made. Tree-sitter's trees, the C heap's, are held the same way (syntax.held_trees).
src/replica.zig: an `Authority` records its core's every input to a tape in memory and hands each client's input back as a unit (origin, sequence number, its tape); a `Replica` applies its own input at once, as the authority will (update, then pump), recorded by its own tape (tape.zig's speculation mode), and for each unit in order drops its pending head when the authority recorded the same (inputs, host calls and answers: the fast path), else puts the copy back, replays the units since and this one (every digest checked) and applies its pending inputs again. A host call or a syscall stops a speculation: it is answered harmlessly, undone when it returns, and the input waits for the authority's answer; a clock or environment read is a guess the comparison checks; an emulator is the authority's (terminal.zig's writers stop a speculation; a safe build asserts none changed). The view's events (a resize, the pointer) wait. Messages are bytes: no transport yet.
Each client has a view of its own (src/views.zig): the authority goes into it before the client's input (`toView`, taped), the replica's speculation the same, and the copy walks the views not live too (`parked`, each pane's `pv`).
test/replicas.zig (`zig build replicas`): one authority and N replicas, a view each (`--shared` puts them in one), each client typing monkey.zig's mix at 50-200 ms over its own link (half the RTT plus 10% jitter, in order), the authority's pty echoing 2 ms later; gates: no replica diverges, every replica's digest is the authority's at quiescence; reported per RTT: inputs applied at once, stopped, waiting, fast paths, rollbacks (mispredicted, foreign), and what a speculative apply, a copy and a rollback cost. 3 clients x 100 inputs at 30, 80 and 207 ms: no divergence over 12 Debug seeds and 20 ReleaseFast ones with a filled heap; ReleaseFast p99 a speculative apply under 0.2 ms, a rollback under 1.6 ms. `zig build rollback-bench` times the real copy now (take, release, an edit, restore).
What the replicas found, fixed: a release build reads what the heap had where Debug's fill made two cores agree: `col_panes` and `restore_buf` digested undefined (zeroed now), `terminal.State.reply_dropped` never set at create, `Text.sels` and `PendingPipe.ranges` digested past their length (a walker `len` cuts a slice too). PARDES_REPLICA_FILL fills a replica's allocations to show what is left.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
| |
emptied when its view goes live, so a pane closed before that view parks again frees no selections that are not its slot's
installed() wrote the slots of the views not live and marked every open view's known, the live one's left as it was; and unpark() left a view's slot holding the selections it had just given the live body. A pane made, then closed while its view was still live and torn down after another went live (a Zerox twin closed at once, say) freed that view's slot: whatever the slot held, or the live body's selections a second time. A view's slot is now made fresh for the live view as for the others, and holds no selections while its view is live. Found by test/replicas.zig, whose replicas switch views on every input; the views unit tests and snapshots (views, views-pan, views-term) pass as they did.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
-L` can forward, refuses another build's hello in words and hands the connection to its session, which welcomes it and answers pings
The daemon binds `pardes-replica.sock` beside its own (SOCK_STREAM, so ssh can forward it; the SEQPACKET socket that carries fds stays local) once it holds its lock. A replica's first message is a hello (detached/wire.zig, now version 14): the protocol version at offset 0, the client's semantics hash and the session's name. The daemon reads exactly that much and no further, so whatever the client sends next is the session's, keeps up to 16 hellos still on their way (ponytail: one that never comes holds its slot until it hangs up), and refuses in words another protocol, a session nobody has, or another build: every session now says its own hash in its registration (daemon protocol 2), so a mismatch never reaches it. An accepted connection goes to the session over its link (SCM_RIGHTS) and the daemon keeps no copy; the session welcomes it with its pid and name on a thread of its own and answers each ping with a pong, until bye or a hangup. ponytail: that stub is all a session does with a replica until phase 5 proper; it is what times a round trip through the handoff and `ssh -L`.
The semantics hash (wire.semantics) is phase 1's undone item: the protocol, the release and commit, the platform, the build options, every dependency the manifest pins by its content hash (grammars, ghostty, the Unicode tables: build.zig's new `deps` option) and the walker codec's assumptions (pointer width, byte order). Not the OS: a Linux client of a FreeBSD session is the main case. ponytail: an unstamped build has no commit, so two dev trees of one release with the same options are not told apart. `pardes --version` prints it on a second line. The hello lost its grid (a replica's view takes a resize like any other input).
test/daemon.py: a hello of this build welcomed by the session itself (its pid, one fd more in the session and none in the daemon, and back once it hangs up), 50 pings, another build's hello and an unknown session's refused, and `--ping <socket> <session> <pardes> [n]`, which times a hello and n pings on any replica socket (a forwarded one, say).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
cursor, a shell's prompt never out of sight, an arrow in the gutter where rows are above; a name drafted in a tag is the view's that opened it
A terminal takes the size of the view that typed into it last; a shorter view used to show its top rows, the prompt below them cut. It now passes over as many as keep the cursor's row in sight, as tmux pans a bigger window in a smaller client: `Pane.pan` (per view, derived) is made in the step's sync and again when a view is drawn out of turn (views.unpark), by terminal.panFor (0 in the view that sizes it, in one tall enough, or folded), and read where the body's rows start: `Pane.scroll`, the body walk in tty mode, the visible cursor. One view never pans: the view that sizes a terminal returns 0 at its first test.
A `.name` prompt (a file's name drafted in its tag) is the view's that opened it (`Pane.prompt_view`): another view's step, where that pane has not the keyboard, no longer drops it; its view closing does.
views-pan.snap: a shell sized for a 24-row view, its last lines and prompt in a 12-row one under the arrow, then typed into from the short view and sized for it. A unit test: the short view's frame has the cursor's row, and the line on it, inside the pane. docs: the notes, the reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
and what is not done; ponytail marks for the shortcuts left (a paste shared by every terminal, a second window's hit test, one display density per process)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
another view, up to four; Detach lets one go); phase 4 notes in docs/next-daemon.md; tty: Screen.hungUp reads a test terminal's fd as the test build has it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
acknowledgement moved the live session's pointer and hover, and a replica that draws nothing applied it to another view); daemon.py attaches a second terminal and a second window beside the first; views-term.snap pins a terminal shown at two sizes
Found by `pardes-monkey --views=3 --tape`: 4 of 6 seeds diverged at acknowledge_panel_presentation inside the pump, the recording having moved the look-hover of the view it drew and the headless replica that of the live one. A view's panels are acknowledged when it is live and drawn. With it, 6 of 6 seeds replay in all three replicas.
test/daemon.py: with the first terminal attached, a second `pardes --attach` gets a view of its own; both are drawn (a line run in the shell shows in each), then it is detached from inside (its stub ends 0, the first draws on) and, again, its terminal closed outright; fds of the session and the daemon level. --gui: a second `pardes-gui --attach` while the window is open opens another (its captures under view-1), and Detach closes only it. views-term.snap: a terminal typed into from the big view is sized for it and shown at that size in the small one, then the other way round. ponytail noted at Pardes.sizes: a view smaller than the terminal shows its top rows.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and scroll over the panes they share; a second `pardes --attach` draws on its own terminal beside the first, and `pardes-gui --attach` opens another window
The core still sees one view, the live one, in the fields it always had (src/views.zig): a view's share of the session (`views.fields`: its screen, columns, rects, focus, pointer and gestures, jumps, key prefixes, column tags, presentation and animations, windowed and native_images) and of each pane (`PaneView`: its place in the layout, which text has the keyboard, the body's cursor, selections and mode, its scroll, a document's size, what the step measured of it) is copied out when another view goes live and back when it is live again. One view never parks: the single client pays a test of one byte a step. `toView`, `openView` and `closeView` are taped inputs; the pump draws each other view by going into it and back, which leaves every digested field as it was, so the replica that draws nothing skips it. A parked view is in no digest (its slot is written whenever it goes out); what drawing it made of its own (animations, presentation) is kept, whatever its unpark brought inside a changed text is done again when it is next live.
Shared: the panes' text, terminals, tags, prompts, messages, registers (yanked in one view, put in another), the workspace tag and settings. A terminal shown at two sizes takes the size of the view that typed into it last (`Pane.sized_by`), and any view's once that one is gone; the others show it at that size. A text edited in one view moves the other views' cursors and scroll with the splice, as a Zerox twin's (File.ParkedPlaces). A pane closed in one view leaves the others' layouts (by its slot's serial); a pane focused in a view that does not show it is placed in its active column (views.show).
tty: each terminal is a Screen of its own (its vaxis, input reader, frame answer, kitty images and shm probe, glide, trail and flash); its input reaches the loop as its view's (a `from` ahead of it when another terminal posted last, so one terminal posts none). A SIGWINCH asks every terminal its size; a SIGHUP asks each whether it hung up or lost its stub. Detach, or a terminal's end, with other views left closes only that view, its stub told `d`; the session's end tells every stub. daemon.zig: an attach names an attached session too (or the only one there is when none is detached).
gui: the Gui holds the live window's share of itself (window_fields: the SDL window and its presenting, scroll, glide, scene and post chain, pointer, blink, captures); the others wait in Shell.windows, swapped in (`follow`) as the core's live view changes, and each SDL event first takes its window's view live (`route`). Closing a window while others stay closes its view.
Harnesses: `start <rows> <cols> views=N` in a snapshot script gives the app N-1 more terminals (PARDES_TEST_VIEWS, opened as attached ones), `view <k>` types into and captures terminal k, every wait reads them all; `pardes-monkey --views=N` switches among N; `zig build replay` runs its seeds at three views too. views.snap pins two terminals: an edit seen in both, a scroll in one, a line yanked in one and put in the other, Newcol in one, Detach in one. Unit tests: own cursor, scroll, mode, layout and focus; edits shared; registers shared; terminal size by last typist; closing views; drawing the others leaves the digest; a view keeps its place in a text another edits.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
ghostty's own records by content address, a delta a screen of row hashes and the blobs the peer lacks, history fetched by absolute row
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
| |
reads queued at most, so it costs no frame a 4 KB read and holds no key or echo behind it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
time: its stamp and the unattended expiry read the clock again, through the tape
Moving them onto the session clock (now_ns, for the replay) stamped a
message with the last pump's time: written over 9P after an idle spell
longer than MessageLinger, it was as old as the spell and an unattended
session expired it at once (fs.py's unattended_messages_expire failed
when its session sat idle first). Both read CLOCK_MONOTONIC as before,
as a taped value, so a replica reads the recording's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
one made again for every frame
File.geometry is made by whoever asks first, a step or the frame; the
render made it afresh all the same (so that an input its key missed
would show only as a headless divergence, never as a stale frame).
That cost every scroll a third walk of the body's rows: the step made
the map for its ensureCursorVisible, the frame made it again, and the
paint walked it. PageDown in the perf harness ran 4% over the base,
outside its 2% A/A spread. Drawn from the step's map, a scroll walks
the rows twice, as before the geometry was the step's. An input the key
misses now shows as a stale frame, which the snapshot goldens catch
(all 110 unchanged).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
replicas that must reach the same digests; the core's leaks of render, clock and host closed
The recorder (src/tape.zig) is null unless PARDES_RECORD=<prefix> names a tape (<prefix><pid>.tape); the local path pays a null check a call. It records a tree at the host boundary, both ways: each call the host makes into the core (`Input`: update, serveFs, pump, perform, the shell's acknowledgements and failures, a Restore, ...) with its arguments, and each call the core makes out -- a Host function (the vtable wrapped generically while recording) or a syscall of its own (`tape.site` for every old `turn.yield()`, `tape.value` for a clock or environment read) -- with its result; `done`/`ret` close each, a 9P request served while a step is out lands inside that step's syscall, and fields a host writes between calls (native_images, present_skipped, ...) are found by a diff at every crossing. After each call the host made at the top, the session's digest (src/walk.zig), one per field of the core, its stream and each pane, file and places.
`PARDES_REPLAY=<tape> pardes` (main.zig) replays it with the same build into three replicas: two at different addresses (the first's memory held while the second runs) and one that never draws. A host call answers what it answered, a site returns what it returned, nothing is performed and no syscall is made; `turn.yield` panics in a replica, so a syscall no site covers is a stack trace; a call the recording did not make, or a digest that differs, is a divergence that names the fields. The headless replica steps over the presents it does not make, applying what the host told the core inside them.
What the replicas found, fixed:
- Render wrote core state. The view's geometry (wrap map, context rows, body layer rows) is File.geometry, a lazy cache keyed by a hash of what it is made of (revision, scroll, size, tags, tables read, context declarations, the session's view: wrap, layered context, row metrics, rect); the render makes it afresh, a step reading it makes it on demand (wrapAt, wrapRow, ensureCursorVisible). Context declarations, notice bands and the header's reveal are the step's (sync), the tables' reading the tick's (a first look of 4096 lines, a count, wherever it is asked; the rest a frame's clock budget a tick), and a view's paint-ahead is asked of the host as the frame is drawn rather than queued as an effect.
- The clock: advance's wakes are the recording session's (a picture decoding or a fade adds no tick to a replica), as are the budgets of Places, Names and Tables (`tape.over`), a message's time of day (the stamp; msg_said_ms and the unattended expiry use the session clock), File.mtime, and the pump reads its clock whether or not it waits.
- The host: the session directory (getcwd, asked once at init), $SHELL and its existence, $HOME for `~`, `Shell` naming one that is not there, a missing interpreter, a directory refused above, a deleted file, a pointer seen through a sliding pane (Pardes.pointerCell).
- Worker handles (futures, the Io), the 9P server's state, the store file every window shares (a replica keeps its own in memory) and Recent read from it are authority-only; frames, animations and the render's caches local. Query rows' paints count apart from a view's.
Terminals replay from their taped pty bytes and are digested as their active screen, cursor and scroll; kitty images are left out until phase 5's screen-state terminals. tagnav.golden: the header's caret reveal now runs every step, as a pane's does, not once per frame drawn, so after `g l B B` typed in one burst the bar stays scrolled as a human typing it sees it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rawAtDisplay no longer measures the rest of the line first
File.rawAtDisplay took the display width of the whole rest of the line
before walking to the column, so every byteAtRowDisplay on a row of a
2 MB line measured 2 MB: a selection whose head is deep in such a line,
with the line's first rows in view, drew in 20 ms (Debug) instead of
0.1. Only a line that ends before the column is measured whole now, and
it is short. Same answers, at the end and past it included (the test).
The perf gate's deep-sel cell had never drawn that line: its view, set
by ensureCursorVisible from the last frame's wrap map, stopped six
lines short of it. With the map made for the view as it is (File.geometry,
next commit) the line is in view and the walk showed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
value (the replay digest) and encodes and decodes it (the tape's values)
Values, never addresses: a pointer is followed, a slice is its elements, an ArrayList its items, a hash map its entries in no order, a DynamicBitSet its bits; an allocator, an Io, a lock or a worker's future is machinery and walks to nothing. A type it cannot see into (a pointer to an opaque thing or a function, a many-pointer, an untagged union) is a compile error naming the struct and the field, until the struct says what the field is:
pub const replica = .{ .local = .{...}, .derived = .{...}, .authority = .{...}, .len = .{ .{ "jumps", "njumps" } } };
local (this process's own: frames, animations, caches of the host's), derived (made again from the rest), authority (held by the session that performs effects alone) are in no digest; `len` hashes a fixed array only as far as its length field says, since the rest is undefined (0xAA in a safe build, and a slice in it faults). A name that is no field is a compile error, so a rename cannot put a field back in quietly. `fieldDigests`/`fieldNames` give a digest a field, which is how a divergence is narrowed down. encode/decode are native byte order and an error is its number in this build: for the process that wrote it, or one of the same build.
Phase 2 is to make the complete dump on the same walk (docs/next-daemon.md); nothing uses it yet.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
blocked for good while keys still work
vaxis's event queue woke one blocked writer, and only on the pop from full. The tty's loop has two writers on it: a pane's pty reader, and the input reader posting the wake for a frame's answered status request (FrameAck). Under `yes` both block on the full queue; the loop then takes a whole batch, its first pop wakes one of them, the rest wake no one, and the pty reader waits for good: the program in the pane blocks writing to its pty, the pane stops moving, and every key still works. It happened from about 400 KB of output, every time at 1 MB, through the snapshot harness's pty as through a terminal.
build.zig patches vaxis's src/queue.zig at build time, count-checked as its Parser.zig and Vaxis.zig are: a pop that makes room wakes every blocked writer. A test (src/vaxis_input.zig) empties a full queue in one batch with two writers waiting and requires both to land. `yes | head -c N` through a bash pane in tty mode now finishes at 1 MB, 10 MB, 100 MB (16 s) and 1 GB (179 s, test/perf.zig --live).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
-c 1G` through a real pty, and a big file's open
The baseline the daemon work is measured against (docs/next-daemon.md). `pardes-perf --live <pardes>` runs the real tty binary in a pty (test/e2e_harness.zig, as the snapshot harness does): FrameStats.keys's gestures (key-down, key-right, edit-char, page-down, wheel) on the 50k-line fixture, a phase each, each frame's latency from the shell taking the input off its queue to the end of its present, read back from the session's PARDES_FRAMES dump; `yes | head -c 1G` typed into a bash pane in tty mode, wall time to the mark after it and the frames drawn; and a 1,000,000-line file opened on the command line, wall time to its first line on screen. `--live-gui <pardes-gui>` runs the same gestures as the GUI's own timedemo (PARDES_FRAMES_DEMO=keys) in a hidden test window. p50 and p99 per phase, pooled over --reps runs; text or --json.
Each run has a private home (bash with a `$ ` prompt), XDG_RUNTIME_DIR and fixtures under $TMPDIR, all removed after. The frames dump now says the monotonic time of its first frame (`# t0_ns`), so a driver lines its own phase times up with the frames'.
The perf gate's baselines (test/perf-baseline-{tty-debug,tty-fast,gui-debug}.json) are recorded again: the harness id is perf.zig's hash, and the medium cells came out within about 10% of the old ones (edit-char and edit-twin faster).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
terminal's HUP and detaches
PR_SET_PDEATHSIG (FreeBSD: PROC_PDEATHSIG_CTL) in the session child,
cleared again at Detach so the stub's own exit then is no hangup; a stub
dead before it was set hangs up at once. It is the HUP the signal thread
already takes (blocked in every thread, sigwaited), and setsid does not
touch it. An --attach stub is no parent of its session: one killed so
still leaves the session drawing until the terminal closes or Detach.
test/daemon.py kills a session's stub outright under a shell that keeps
the terminal (on FreeBSD the session leader's exit revokes it), waits
for the session to put the terminal back and detach, and attaches it
again; without the death signal it times out.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
ends: the reader that takes the daemon's ok starts before kept() waits on it
The reader starts after the first frame, and a hangup handled in that
frame had kept() wait its full 2 s for an `ok` nobody read, then end the
session. test/daemon.py's killed stub hit it 2 times in 55 under load,
and none in 95 after.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Closing a 256 MiB +Pager base64'd and serialized its text (8.5 s in
Debug, the session answering nothing meanwhile) only to throw the record
away: an output pane's record always holds its text whole, so its length
decides first. fs.py's remove of that pane timed out on it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
which made a walk of a directory just made answer ENOENT
The tty frame's tick sweeps the table with the turn, but the turn comes
back to the editor after a step of its own with a 9P request still out
in a stat: the entry that request's walk had just made, which no fid
named yet, was freed under it, and the next element looked up nothing.
That was fs.py's one-in-a-few `/os` listing failure; walks of a fresh
directory against file churn in the session's directory failed 144 in
2799, and none in 4440 after.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
connect, which FreeBSD refuses to a full listen queue as to a dead socket
The owner holds `<socket>.lock` flocked from before it binds until after
it unlinks (claim, release; the fatal-signal path unlinks it too). The
startup sweep, the registry sweep, a registry entry's replacement and
`taken` ask that lock: held is live, free is dead. They unlink only while
holding it, so no new owner comes between the judging and the unlink,
and two starters of one name are told apart by who took it. A socket
with no lock, a pardes from before the locks, is still judged by a
connect. The daemon's own start was already decided by its flock.
The sweep test gains a live session whose socket refuses connects on
every system (bound, not listening, its lock held) and a dead one's free
lock, which goes with it; it passes on the FreeBSD box now.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and fs.py without /proc
- The refusing directory some tests name is Linux's /proc/1/root: that
part skips elsewhere. The committed builtins-*.json are Linux builds'
(Tty9p): their check skips, and a key the docs give a word this build
leaves out is found in the other's list.
- kitty: a shared memory object is sized before it is written (FreeBSD's
write does not grow it); a FIFO in /dev/shm is Linux's case.
- daemon.py asks ps and procstat where there is no /proc, and finds bash
on PATH. fs.py runs printenv once a name, and skips two permission
checks as root, who searches and writes anywhere.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
daemon included
Cross-compiled with -Dtarget=x86_64-freebsd.15.0 (15 ships libutil.so.10;
Zig's default 14.0 links .so.9) and run on the FreeBSD 15.1 box:
- 9p_io serves there: fstatat, not Linux's statx. madvise is Linux's.
- WINCH reaches the sigwait thread through a handler that does nothing:
FreeBSD drops a signal ignored by default as it is sent.
- A dead terminal answers a write with ENXIO, which std does not expect: a
Debug build traced it to stderr, that same terminal, and recursed until
the stack ran out (a session whose ssh dropped hung). No tracing there.
- waitid's FreeBSD numbers and 64-bit id: a command pane's exit is seen.
- No /proc: a shell's directory and program by sysctl, ttyTaken by the
foreground group, the foreground job's name by its program.
- File watching by FreeBSD 15's inotify.
- ghostty's kitty loader: off Linux a stat comes before a t=f open (a FIFO
hung it); FreeBSD's shm_open refuses O_NONBLOCK.
- vaxis's test terminal has no read off Linux: no input thread for it.
- test-install: the test-build programs installed into <prefix>/test, to
run where the build cannot.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
| |
docs/next-daemon.md
building.typ's detached sessions are the daemon and its sessions; the guide, cheatsheet and reference say what Detach, a closing terminal, --attach of each kind and Adopt do, and that attaching from another machine waits for phase 5. docs/next-daemon.md records the forks taken (sessions register and are not the daemon's children, and why; how it starts; masters; Adopt as a word; the stub's signals and job control; --detach; the Attach word; the harness switch), the known gaps, and the termios trap.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
| |
wire.zig
Nothing draws a session's screen from frames any more: a session is always an in-process authority with its terminal or window, and remote clients come back as replicas (docs/next-daemon.md, phase 5). server.zig, the third host and its frontend socket, the smallest-common-grid rule and its 32 frontends; client.zig, the frontend half; wire.zig's frames, cell and layer codecs, server messages and the post chain on the wire. wire.zig keeps the framing, the hello and its version (now 13) and the input events, with their tests, for phase 5.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Detach and --attach in place for terminals and windows, pty masters kept, Adopt
pardes in a terminal reaches (or starts) the daemon, opens /dev/tty and forks: the child is the session, in a session of its own (setsid), drawing on that terminal (tty.Term.fd, a raw vaxis Tty made from the fd); the parent stays as its stub, the job the shell waits on. Not the daemon spawning it from a passed fd, env and argv: the user's terminals each run in a 9ns user and mount namespace, which a session spawned by a per-user daemon would not share, and a fork costs one small process's page tables where the spawn cost an IPC and an exec. GUI windows and --detach sessions just register.
tty: Detach (and a terminal's end: EOF, EIO, a hangup the stub passes on, taken on the signal thread) puts the terminal back, drops it and the stub's stdio, tells the stub (which ends, exit 0), and leaves the session running with nothing drawn (Host.watched), its messages on the clock and `size` its own. pardes --attach[=name] hands its terminal through the daemon; the session enters it as the first one, sized, queried and drawn whole, and that process is its stub until it leaves. A hangup never ends a kept session; TERM and INT do, telling the daemon so the shells go with it (one async-signal-safe send).
gui: Detach closes the window (its swapchain or renderer) and keeps the device, atlas and pipelines; the loop sleeps on SDL's queue; pardes-gui --attach[=name] opens a window again. Closing a window still quits.
--detach is a session started detached: the tty host with no terminal yet, the GUI with a hidden window closed at once. forkShell sends the daemon a dup of every master and the hosts tell it what they close, so a session killed outright leaves its shells running; the new Adopt word takes them in as terminal panes (the Tty word's pane, its spawn taking the pty, a 1x1 size then the pane's to make it redraw).
The Attach word, which switched a session's own terminal to a detached session through the frames, goes, with its effect and request in the core. PARDES_DAEMON=off (the e2e harness's) runs a session as before. test/daemon.py: 50 detach/attach cycles at a level fd count with no stale socket, kill -9 and Adopt, and nothing left; --gui the same for a window. test/fs.py: a forked session's socket is found by its own pid, and a hangup leaves a kept session running.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
terminals to detached sessions
`pardes --daemon` listens on pardes-daemon.sock in the runtime directory (ninep_io.socketDir), its .lock flocked for its life so two never run. The first session that finds none takes the lock, binds and listens itself and queues its own connection; the daemon is then double-forked and exec'd onto that listener and lock (fds 3 and 4), by a terminal's stub after the session's fork, so no startup waits for it: the hello sits queued, and the `ok` is the reader thread's. Another starter waits on the lock; a stale socket is the lock holder's to replace. Idle a second (no connection, no master held), it unlinks the socket and exits.
It spawns nothing and is nobody's parent: a session registers on one connection (hello: kind, pid, name, attached or detached), sends a dup of every pty master it forks (`pty`), says which it closed (`close`) and when it ends (`quit`, its shells hang up), and asks for the masters of sessions that died holding them (`adopt`). A master whose shell is gone (POLLHUP, polled with no events, its output never read here) is dropped. `attach` hands a terminal and a stub's pipe (pardes --attach), or a window request (pardes-gui --attach), to the detached session of that name or the only one, and refuses in words: no such session, attached already, the other kind. SOCK_SEQPACKET datagrams, a line of words and the fds they carry.
The client half: connect (starting one), register, the session's link and its reader thread, and the stub a terminal's session leaves behind (forkSession, stubWait), which passes WINCH, TERM, INT, QUIT and HUP on and ends with the session's status.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
| |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
lowest first, and the tty hands z on to the outer terminal (under the text below 0); real clients recorded, replayed and run live
z-index was lost: an ImagePlace had none, so every image went over the cells in hash-map order, a z<0 picture (a background under text) over the text and overlapping images in any order. ImagePlace.z now carries the placement's z (a virtual placement's from its placeholder target), TerminalImages sorts what it appends lowest z first (stable), and the tty's exactKittyPlacement sets vaxis's z_index, so a kitty terminal outside stacks them and puts z<0 under the text. The GUI draws them in that order but still over the cells: under the text there needs a glyph pass after the images (ui.frag's clear_bg_bit) in gui.zig's vertex buffer.
Real clients: test/kitty_harness.zig's PARDES_KITTY_EXPLORE runs commands in the pane under script(1) and prints what pardes placed outside; kitten icat 0.49.2 (--align left/center/right, --place, --scale-up, --unicode-placeholder, --clear, file/memory/stream/detect), chafa 1.18.3, viu and yazi 26.9.1 all landed where they should. Their recorded traffic (test/kitty-fixtures/*.vt) replays through the core (test/kitty.zig) to the cells they drew live. The harness now also runs yazi live (shared memory, a virtual placement, placeholders), checks z=-1 outside, and runs a second pardes under a terminal without kitty graphics: no graphics command reaches it and the image is glyph art in all 32 cells. The harness empties NO_COLOR (zig build sets it, and vaxis drew no colour at all under the harness) by setenv, not unsetenv, which compacts the environment std captured.
Also: tests that a pane's image follows pardes's own scrollback, an edited copy taller than its rows, a narrow pane's edge, Collapse and a cell-size change; and a knownGap: images do not survive a dump (Dump, Handover, a pane reopened from the Store), whose VT text has none.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
linked by ghostty-vt), stb_image without them, its writer and its inflate, SDL without its private stb_image; a symbol-table guard; docs/shared-libs.md
ReleaseFast before, both binaries carried stb_image's PNG, JPEG and inflate beside wuffs's (whose function tables keep its decoders linked whatever pardes calls), stb_image_write and its deflate (unused), and the GUI a second stb_image of SDL's (SDL_stb.c, for SDL_LoadPNG and camera MJPEG). Now:
- image.zig decodes PNG and JPEG with wuffs (`wuffs_images`, wherever ghostty-vt is in the build), sized from the IHDR or the first SOF before decoding, as stb's info call sized them; other formats and the builds without ghostty-vt keep stb_image.
- build.zig compiles zstbi with -DSTBI_NO_PNG -DSTBI_NO_JPEG and patches its stb_image_write include out (one count-checked anchor; a no-op stbi_flip_vertically_on_write stays for zstbi.deinit), and SDL with SDL_DISABLE_STB.
Text: tty -74,488 bytes, gui -154,392.
`zig build shared-libs-check` (in unit-test, ELF) reads the linked symbol table and fails on a family the build chose against: stb's PNG/JPEG/inflate beside wuffs, a second stb_image, stb_image_write's deflate, a second zlib or FreeType. Checked against the old binaries: it names every one.
docs/shared-libs.md: the inventory (implementation, users, copies and bytes before and after, allocator hook) and where one copy was not possible: zlib and wuffs both inflate (FreeType's and MuPDF's zlib API vs ghostty's kitty o=z), MuPDF's libjpeg beside wuffs (filter-dct.c is libjpeg's API), MuPDF's unreached fitz image loaders, base64 in Zig std/simdutf/MuPDF, per-library Unicode code, std.debug's flate.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|