From 99f5b10eccd95aa0066ea6fe6bb75f367ab56a47 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 18 Nov 2026 22:03:14 -0300 Subject: core: src/ becomes core/, pardes.zig its root.zig (the reorganisation's tree, step 2d), and every mention of a src/ path follows: the build's paths, the core's imports of its root, the tests that read the repository's files by path (lspbench's, look.zig's spans over core/look.zig), the comments that cite files, the documents and the manual (the typst corpus reads core/tutor.txt and core/plumbing); left as they were: the /src tree's served names (src/pardes.zig and the rest are the 9P tree's, not the repository's), the CHANGELOG's history, fixtures that are only strings; fs-unit-test runs from the core's root (a module of the core rooted at fs.zig had the runtime's and the devices' `core` be fs.zig); nothing else changes: the ledger (pardes.test.* now root.test.*), frames byte-identical, replicas and process-test the base's Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/diff-pager-proposals.md | 4 +-- docs/ghostty-macos-notes.md | 6 ++-- docs/helix-keys.md | 28 ++++++++--------- docs/lsp-evaluation.md | 12 ++++---- docs/macos.md | 44 +++++++++++++------------- docs/next-daemon.md | 72 +++++++++++++++++++++---------------------- docs/next-drag.md | 2 +- docs/next-editor.md | 4 +-- docs/next-plumber.md | 20 ++++++------ docs/next-run.md | 4 +-- docs/next-searchrows.md | 4 +-- docs/next-store.md | 2 +- docs/next-terminal.md | 24 +++++++-------- docs/next-tests.md | 10 +++--- docs/search-proto-converge.md | 20 ++++++------ docs/selections.md | 2 +- docs/shared-libs.md | 4 +-- docs/typ/README | 8 ++--- docs/typ/book.typ | 2 +- docs/typ/building.typ | 40 ++++++++++++------------ docs/typ/guide.typ | 4 +-- docs/typ/reference.typ | 24 +++++++-------- docs/typ/running.typ | 2 +- docs/typ/style.typ | 12 ++++---- 24 files changed, 177 insertions(+), 177 deletions(-) (limited to 'docs') diff --git a/docs/diff-pager-proposals.md b/docs/diff-pager-proposals.md index f75361df..2edb950a 100644 --- a/docs/diff-pager-proposals.md +++ b/docs/diff-pager-proposals.md @@ -52,7 +52,7 @@ pager at the top of the work tree even when run from a subdirectory (checked), so `` is already the base git's repository-relative paths need. -A pane that is a diff is read by `src/diff.zig`. It is already at delta's +A pane that is a diff is read by `core/diff.zig`. It is already at delta's level, or past it: - A hunk's end comes from its `@@` counts, as patch reads it, so a removed @@ -122,7 +122,7 @@ delta's marks exist because less cannot search by structure. In pardes in a diff pane's tag. Or an `Index` exec writes a +Index pane with one line per file or hunk, each a look: - @p12:345 src/look.zig +12 -3 + @p12:345 core/look.zig +12 -3 ### E. A diff you can act on diff --git a/docs/ghostty-macos-notes.md b/docs/ghostty-macos-notes.md index 3974d0d8..830d4b1f 100644 --- a/docs/ghostty-macos-notes.md +++ b/docs/ghostty-macos-notes.md @@ -30,7 +30,7 @@ constant with no Zig tag. This is the single most transferable thing in the repository, it costs about ten lines of build plumbing, and it runs on Linux. pardes now does the same thing in -`src/macos.zig`, extended to compare exported function arity and scalar widths as +`runtime/macos.zig`, extended to compare exported function arity and scalar widths as well, because a hand-written header drifts in signatures too. ## Zig→host is one callback, not N @@ -56,7 +56,7 @@ comptime { The payoff is that adding a feature adds an enum case, not a struct field: hosts that do not implement it return `false` and the ABI never changed. Worth copying the day a fixed callback list starts growing. pardes has three callbacks today -— `wakeup`, `set_clipboard`, `read_clipboard` (`Runtime` in `src/macos.zig:153`) +— `wakeup`, `set_clipboard`, `read_clipboard` (`Runtime` in `runtime/macos.zig:153`) — and does not need it yet. Two userdata scopes, worth noting: the runtime struct's `userdata` is @@ -102,7 +102,7 @@ there Swift owns an `MTKView` and passes a command buffer *into* Zig (`ghostty_inspector_metal_render`, `macos/Sources/Ghostty/Surface View/InspectorView.swift:417`). pardes inverts this deliberately — see `docs/macos.md`. The short version: a -terminal grid rendered by a hand-written Metal atlas is what `src/gui/gui.zig` +terminal grid rendered by a hand-written Metal atlas is what `dev/gui/gui.zig` already spends thousands of lines on, and a cell grid is exactly what CoreText draws natively. diff --git a/docs/helix-keys.md b/docs/helix-keys.md index 86c50722..f3dd2dc3 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -20,21 +20,21 @@ injected `comment` layer) touches the editing code, and it needs tree-sitter, which the harness runs without. Code map, by SYMBOL — line numbers rot, names do not. Body-normal key -RECOGNITION is `modal.Normal` in `src/modal.zig`: a state machine over `Role` (one -per bound command, named as `src/config.zig` binds it and matched against its -chord lists by `normalInput` in `src/normal.zig`), the pending prefix and `m` +RECOGNITION is `modal.Normal` in `core/modal.zig`: a state machine over `Role` (one +per bound command, named as `core/config.zig` binds it and matched against its +chord lists by `normalInput` in `core/normal.zig`), the pending prefix and `m` sub-key (each the role of the key read) and a count, emitting an `Action`: the role and what it was given (a count, a literal, `]` or `[`). The roles are grouped by the context a key is read in and tried in their order there. The text's executor (`executeNormalAction`) and a PDF's (`pdf_view.applyNormal`) both switch on the role. It knows nothing about panes or text. Then it is -EXECUTED: `Key` and `handleKey` in `src/pardes.zig` (intercept order is +EXECUTED: `Key` and `handleKey` in `core/root.zig` (intercept order is load-bearing, see the comment there); `handleNormal` (parses directly into `Pane.normal`), `executeNormalAction`, `replaySels` and `multiOnce` in -`src/normal.zig`; and `enterInsert`, `handleInsert` / `insertKey`, `insertTab`, -`normalDelete`, `normalYank`, `pasteText`, `normalChange` in `src/edit.zig`. Undo +`core/normal.zig`; and `enterInsert`, `handleInsert` / `insertKey`, `insertTab`, +`normalDelete`, `normalYank`, `pasteText`, `normalChange` in `core/edit.zig`. Undo and redo live in `panes.File` and `panes.Terminal`. Pure text math: -`src/modal.zig` (the `hx*` family is the helix-semantics layer: gap offsets + +`core/modal.zig` (the `hx*` family is the helix-semantics layer: gap offsets + ranges over the flat text). Differential harness: `test/hxdiff.zig` + `test/hxcases/*.jsonl` — see "Differential testing" at the bottom. @@ -117,7 +117,7 @@ language-backend queries, and the shell pipe. | `zm` | scroll the unwrapped view so the cursor's column is in its middle | helix `align_view_middle`; with soft wrap on there is no horizontal scroll, and nothing happens | out of corpus (the harness's text never scrolls sideways) | | `i` `a` | insert at selection start / after selection end | helix semantics: `i` before the selection, `a` selects and appends after it | helix-verified | | `I` `A` | insert at first non-ws / line end | matches `insert_at_line_start` / `insert_at_line_end` | helix-verified | -| `o` `O` | open line below / above, with helix's indent from the syntax tree where the file's grammar has an indent query (src/indent.zig, as Enter), else the current line's indent as it is (acme's autoindent, tabs and all); `o` opens n | `open_below`/`open_above`, except that helix's no-language fallback rounds the indent down to whole units: under its 4-space unit, two spaces open a line with none (waiver `o-partial-indent-drops`) | helix-verified (whole units) / pardes-specific (partial) | +| `o` `O` | open line below / above, with helix's indent from the syntax tree where the file's grammar has an indent query (core/indent.zig, as Enter), else the current line's indent as it is (acme's autoindent, tabs and all); `o` opens n | `open_below`/`open_above`, except that helix's no-language fallback rounds the indent down to whole units: under its 4-space unit, two spaces open a line with none (waiver `o-partial-indent-drops`) | helix-verified (whole units) / pardes-specific (partial) | | `v` | select (extend) mode: motions extend from the fixed anchor; `v` again exits KEEPING the selection | mode "select" is reported only while this is on (helix keeps mode normal for x/%/mi selections) | helix-verified | | `x` / `x` | select current line / extend one (n) line(s) down, char-range through the newline, cursor ON the `\n` | col-0 vim-ism removed (phase 5); matches `extend_line_below`, mode stays normal | helix-verified | | `d` | delete selection (implicit or explicit); bare cursor = the 1-wide selection | always yanks (`Alt-d` noyank in B); terminals: drops typed runs only | helix-verified | @@ -137,11 +137,11 @@ language-backend queries, and the shell pipe. | `Space` (normal, body) | starts the pardes LEADER: a key path runs the same builtin words used by tags and the topbar. The main groups are `f` files, `h` docs, `c` columns, `t` toggles/effects, `a` panel animations, `s` session, `j` jumps, `l` language, and `w` directional focus; `SPC ?` lists every path and ` ?` lists one group in `+Help`. Neither `Exit` (quits the editor, acme's Exit) nor `Kill` (stops the commands pardes typed into terminals, acme's Kill) has a leader path: both are the topbar's and the root `ctl`'s. The pending path appears on the active pane's transient body/message row. Esc or an unmapped key abandons it. Paths, Help rows, and dispatch are all generated from the builtin registry at comptime; the leader applies only to a BODY in normal mode because tags and tty programs own their input | pardes-specific; helix spends Space on pickers/LSP (section C), while pardes uses acme-style executable words | | `SPC y` `SPC Y` `SPC p` `SPC P` `SPC R` | helix's clipboard menu on helix's own letters: yank the selection to the system clipboard (`ClipYank`) or the PRIMARY selection alone (`ClipYankMain`), paste the system clipboard after (`ClipPaste`) / before (`ClipPasteBefore`) the selection, replace the selection with it (`ClipReplace`) | the same as `"+y`, `"+p`, `"+P`, `"+R`: register `+` (and `*`) IS the desktop's clipboard, the only register that reaches it. `SPC y` writes `+` alone, as helix's does, not the default register too. Builtins rather than bare chords because a leader path names a builtin: they land in Help's index and are executable words like every other verb. The clipboard holds one text, so N values go out joined by newlines, as helix sends them. On a tty the write is OSC 52 out and the READ is OSC 52 back, which many terminals refuse or gate — so `SPC y` works there and `SPC p` can be a no-op | out of corpus | | a paste from the OUTER terminal | one `Event.paste`, spliced in at the cursor | the tui shell enables bracketed paste and coalesces `paste_start`..`paste_end` into a single event; before that the bytes arrived as individual key presses and normal mode RAN them, which is how a pasted `d` deleted a line. The bytes deliberately never enter the yank register — clipboard and default register are separate stores in both directions | pardes-specific | -| `/` (a text) | a query pane under the pane (`src/Query.zig`): a `+Search` whose line 1 is the query, typed into; helix's regex with smart case, every match tinted and ticked on the rail as you type (the pane's places, `src/Places.zig`), the first after the cursor selected (helix's incremental preview). `Ctrl-n`/`Ctrl-p` step while typing; Enter lands, fills `/` and keeps the rows as text; Esc while typing restores the text and closes the pane. Line 1's first word names the source (`/`, `Find`, `Grep`, `Recent`, `Panes`, `Symbols`, `All`, `Refs`, `Def`, `Impl`, `Diagnostics`), helix's pickers as one pane. A terminal's and a PDF's `/` keep the notice-band prompt and its `+Search` | helix's `/` semantics (regex, smart case, preview); the pane is pardes' | pardes-specific | +| `/` (a text) | a query pane under the pane (`core/Query.zig`): a `+Search` whose line 1 is the query, typed into; helix's regex with smart case, every match tinted and ticked on the rail as you type (the pane's places, `core/Places.zig`), the first after the cursor selected (helix's incremental preview). `Ctrl-n`/`Ctrl-p` step while typing; Enter lands, fills `/` and keeps the rows as text; Esc while typing restores the text and closes the pane. Line 1's first word names the source (`/`, `Find`, `Grep`, `Recent`, `Panes`, `Symbols`, `All`, `Refs`, `Def`, `Impl`, `Diagnostics`), helix's pickers as one pane. A terminal's and a PDF's `/` keep the notice-band prompt and its `+Search` | helix's `/` semantics (regex, smart case, preview); the pane is pardes' | pardes-specific | | `n` / `N` | next / previous match of the text's places when a query pane fed them (a `/`, a list's places in this text: refs, diagnostics, a Grep's hits), round the ends without a message; else the last search register's regex in the current text, as before; counts repeat | only the primary selection is replaced; in select mode each match is added and becomes primary. Named registers work. `*` sets the pattern from selections with word boundaries (`Alt-*` without) and seeds the text's query pane with it, the keyboard staying. The former Look ring is `LookNext` / `LookPrev`, `SPC j n` / `SPC j p`. PDFs retain their location-result navigation | helix-verified | | insert: printable text | file: real edit; terminal: typed run splice | | helix-verified (file) | -| insert: `Enter` | newline; where the file's grammar has an indent query (vendor/queries/*/indents.scm), helix's `indent_for_newline` over the syntax tree (src/indent.zig, the reference's containment engine, `hybrid` heuristic); else keeps the current line's indent as it is and adds one 4-space logical tab (a tab where the indent is tabs) when the text before the cursor ends in `(`, `[`, `{`, or `)` (including `})`). Between a pair (helix's default auto-pairs) the closer gets a line of its own at that indent and the cursor one a level in (`insert_newline`'s `on_auto_pair`) | plain lines match `insert_newline` at whole indent units (helix drops a partial one, as for `o`); delimiter heuristic is pardes-specific; with a grammar, `test/hxcases/indent.jsonl` against the reference `hx` and its grammars (`hx_indent.py`) | helix-verified (plain, grammar) / pardes-specific (partial indent, delimiter) | +| insert: `Enter` | newline; where the file's grammar has an indent query (vendor/queries/*/indents.scm), helix's `indent_for_newline` over the syntax tree (core/indent.zig, the reference's containment engine, `hybrid` heuristic); else keeps the current line's indent as it is and adds one 4-space logical tab (a tab where the indent is tabs) when the text before the cursor ends in `(`, `[`, `{`, or `)` (including `})`). Between a pair (helix's default auto-pairs) the closer gets a line of its own at that indent and the cursor one a level in (`insert_newline`'s `on_auto_pair`) | plain lines match `insert_newline` at whole indent units (helix drops a partial one, as for `o`); delimiter heuristic is pardes-specific; with a grammar, `test/hxcases/indent.jsonl` against the reference `hx` and its grammars (`hx_indent.py`) | helix-verified (plain, grammar) / pardes-specific (partial indent, delimiter) | | insert: `Backspace` (+ `Shift-Backspace`) | delete prev char, joins lines at col 0; in a line's leading blanks, back to the previous 4-column indent stop (a whole unit when on one; a tab still goes alone) | matches `delete_char_backward` and its dedent; `Ctrl-h` alias in B | helix-verified | | insert: `Up` `Down` `Left` `Right` | move cursor | matches helix's "not recommended" insert arrows | helix-verified | | `gd` `gD` `gy` `gi` `gr` | LSP definition / declaration / type-definition / implementation / references. One answer jumps straight there; several (definition, implementation, references) fill the text's query pane, line 1 `Def`/`Impl`/`Refs`, their places in the text tinted and stepped by `n`/`N`; the others fill `+Search`, where `LookNext` / `LookPrev` walk and Enter opens | Ctrl+left-click is the mouse spelling of `gd`; language support depends on the configured backend | out of corpus | @@ -271,7 +271,7 @@ with what is on screen. Pressed in a tag, column tag or workspace tag they select in that tag's own text, and so does `|` pipe it; `/` searches the body wherever it is pressed (`Pane.prompt_for`). Engine: **mvzr** (`build.zig.zon`), a bytecode VM that compiles a runtime pattern with no allocator, called the way sam searches -(`src/regexp.zig`, shared with a pane's `addr` file): each line is its own +(`core/regexp.zig`, shared with a pane's `addr` file): each line is its own haystack, so `^` and `$` match at every line's start and end and `.` never crosses a newline, and a pattern naming `\n` runs over the whole selection. Where helix's `^` is only the selection's start, this is sam's. mvzr @@ -285,8 +285,8 @@ keeps the matches it found so far. | `S` Enter | split each range on its matches | helix `split_on_matches`; the pieces BETWEEN the matches, including the empty one a leading match produces | helix-verified | | `s`/`S` then Esc | back to the selection the prompt opened on | the empty pattern applies nothing, so cancelling IS the restore — one path, not a second one | helix-verified | | an all-lowercase pattern | matches case-blind | helix's smart-case. mvzr has no such flag, so the surface is lowercased instead (ASCII folding is byte-for-byte, so the offsets are identical) | helix-verified | -| `^` and `$` | hold at every line's start and end | helix compiles with `multi_line(true)`; pardes gets the same by searching each line as its own haystack (`src/regexp.zig`) | helix-verified | -| `.` | never matches a newline | as the Rust regex crate: a pattern without `\n` searches line by line, and one that names `\n` has its `.`s made `[^\n]` (`src/regexp.zig`) | helix-verified | +| `^` and `$` | hold at every line's start and end | helix compiles with `multi_line(true)`; pardes gets the same by searching each line as its own haystack (`core/regexp.zig`) | helix-verified | +| `.` | never matches a newline | as the Rust regex crate: a pattern without `\n` searches line by line, and one that names `\n` has its `.`s made `[^\n]` (`core/regexp.zig`) | helix-verified | | `\s`, `[^...]` | never match a newline unless the pattern names `\n` | the same line-by-line search; helix's `\s` and negated classes do match one, so its `S\s+` also splits at every newline, the last line's too, where pardes keeps a newline inside its piece unless the pattern is `\s+\|\n` (waivers `split-regex-ws`, `split-regex-ws-tty`) | pardes-specific | | many matches | up to `memory.limits.selections` ranges, 1024; matches past it are dropped | helix has no limit. The room for them is allocated when a second range appears and given back at one range, so a single cursor costs nothing | helix-verified up to the limit | | `K` / `Alt-K` Enter | keep only the ranges a match starts inside / only those none does; primary 0, and keeping none leaves the selection alone | helix `keep_selections` / `remove_selections`, on the same prompt as `s`/`S` (markers `Keep /`, `Remove /`). The range is searched as `s` searches it, line by line with its lines' context, where helix matches the range's text alone: a `^` right at a range that starts mid-line matches in helix and not here | helix-verified | @@ -300,7 +300,7 @@ keeps the matches it found so far. | … with mixed indents | the token goes in at the SHALLOWEST indent in the set | helix's `min`, quirks included: a deeper line is commented mid-whitespace | helix-verified | | … uncommenting | one space after the token goes too, unless some line lacks it | helix's `margin` | helix-verified | | … blank lines | skipped entirely, and they do not vote on commented-or-not | helix | helix-verified | -| which token | by file EXTENSION, from `config.comment_tokens` | the same notion of "language" `src/syntax.zig` picks grammars with. No extension (a terminal, an output buffer) or an unlisted one gets `config.comment_token_default` = `#`, which is helix's own `DEFAULT_COMMENT_TOKEN` and therefore what the oracle answers | helix-verified | +| which token | by file EXTENSION, from `config.comment_tokens` | the same notion of "language" `core/syntax.zig` picks grammars with. No extension (a terminal, an output buffer) or an unlisted one gets `config.comment_token_default` = `#`, which is helix's own `DEFAULT_COMMENT_TOKEN` and therefore what the oracle answers | helix-verified | | block comments (`/* */`) | **skipped**: helix only reaches them when a language declares block tokens and no line tokens; every language in the table has a line comment | ### Match mode (`m` prefix) — plain-text, no tree-sitter diff --git a/docs/lsp-evaluation.md b/docs/lsp-evaluation.md index 8f7c0266..b7916ef6 100644 --- a/docs/lsp-evaluation.md +++ b/docs/lsp-evaluation.md @@ -1,6 +1,6 @@ # Three language backends, measured -Same core, same seam (`src/lsp/lsp.zig`), same harness (`zig build lspbench`) +Same core, same seam (`core/lsp/lsp.zig`), same harness (`zig build lspbench`) over the same corpus — 17 probes at the time, 22 today. Three jj workspaces, three independent implementations, one function each. C landed first and went in 0.6; the tree has B's kind of client alone, for every language. See @@ -11,7 +11,7 @@ went in 0.6; the tree has B's kind of client alone, for every language. See > because renumbering a comparison nobody can re-run turns a record into a > guess. What has moved since, re-checked 2026-08-26: `lspbench` now has **22** > probes rather than 17 (the dot-completion work added five), -> `src/lsp/lsp_zls.zig` had grown from 540 lines to **1 432** (1 522 when it +> `core/lsp/lsp_zls.zig` had grown from 540 lines to **1 432** (1 522 when it > went, 2026-09-29), > `test/snapshots/` holds **95** scripts rather than 56 (`.snap` + `.golden` > pairs), and the differential suites are `hxdiff` **481** (`cases.jsonl`) and @@ -101,9 +101,9 @@ real binary through the helix keymap, and pass `hxdiff` (360) and `hxparity` ## Decision **One protocol client, for every language, Zig's included.** C landed first -(`src/lsp/lsp_zls.zig`, ZLS a fetched dependency pinned in `build.zig.zon`). +(`core/lsp/lsp_zls.zig`, ZLS a fetched dependency pinned in `build.zig.zon`). The multi-language argument below won on 2026-09-01, when a protocol client, -`src/lsp/lsp_client.zig`, arrived beside it, and on 2026-09-29 (change +`dev/lsp/lsp_client.zig`, arrived beside it, and on 2026-09-29 (change `kvlpprms`, released in 0.6) the in-process backend went: Zig files ask a `zls` found on `PATH` as every other language asks its server, the ZLS source and its build wiring left the tree, and the binaries shrank (ReleaseFast @@ -131,7 +131,7 @@ A (`nvqpknzm`), B (`stuurqqt`) and C's last state (the parent of **2026-11-05: an index first, the server second.** The words ask the nearest `index.scip` above the file (SCIP, scip-code.org: a protobuf file an indexer writes at the project's root) before any server: -`src/lsp/Scip.zig` reads it, about 350 lines with its tests, keeping each +`dev/lsp/Scip.zig` reads it, about 350 lines with its tests, keeping each document's occurrences and each symbol's information in a fixed region (an index of 512 MiB at most, its tables 512 MiB, two indexes at once). Def, type definition, Refs, SelectRefs, `gi`, Subtypes, Supertypes, Symbols, @@ -158,7 +158,7 @@ second process, and its weakest number is a cache that does not exist rather than a limit that cannot be lifted. The one thing that should override that: **pardes ships tree-sitter grammars for -28 languages** — `src/grammar_manifest.zig`'s `all` has 29 entries, but +28 languages** — `core/grammar_manifest.zig`'s `all` has 29 entries, but `markdown_inline` carries `.exts = &.{}` on purpose: no filename ever selects it, and the block grammar re-enters it by name for its `inline` nodes. So 29 grammars, 28 buffers a language server could ever be asked about. C is diff --git a/docs/macos.md b/docs/macos.md index 17294520..44b77d67 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -2,7 +2,7 @@ Zig owns the core, the ptys, every effect and the worker threads. Swift owns `NSApplication`, the window, input translation, and drawing. They meet at a -hand-written C ABI, `src/macos/pardes.h`, built as a static library that the app +hand-written C ABI, `abi/pardes.h`, built as a static library that the app links; the Swift half is ordinary AppKit that pumps events in and reads one packed cell buffer out. There is exactly one core per process, so the ABI has no handles — the state is a file-scoped singleton and every function names it @@ -32,8 +32,8 @@ Pardes goes the other way because its frame is *already* a cell grid. draw one: attributed runs, the system font stack, and Apple's own subpixel and color-emoji handling, for free. The alternative is a hand-rolled glyph atlas, and the SDL backend is the measurement of what that costs — a large part of -`src/gui/gui.zig`'s 6,348 lines is a 2048² FreeType-hinted R8 atlas (`atlas_w` -and `atlas_h`, `src/gui/gui.zig:140`), GPU pipelines, transfer buffers and +`dev/gui/gui.zig`'s 6,348 lines is a 2048² FreeType-hinted R8 atlas (`atlas_w` +and `atlas_h`, `dev/gui/gui.zig:140`), GPU pipelines, transfer buffers and shaders. Writing a second one, blind, buys nothing the grid needs. Blind is the operative word: this backend was scaffolded on a Linux machine. A @@ -68,18 +68,18 @@ the glyph. IO stays on the Zig side: macOS has `forkpty`, `read` and `write` right there, so almost no effect crosses the boundary at all: `pardes_tick` runs -`while (core.nextEffect()) |e| core.perform(e)` (`src/macos.zig:1154`) and each +`while (core.nextEffect()) |e| core.perform(e)` (`runtime/macos.zig:1154`) and each effect lands on this host's own `Host.VTable`, of whose twenty-one methods -fourteen are filled in (`src/macos.zig:1761`). +fourteen are filled in (`runtime/macos.zig:1761`). The machine-local half of those methods is no longer this file's. `forkShell`, -`writeFileBytes` and `writeFd` live in `src/host_io.zig` and are shared with -the tui shell and the SDL shell; `src/macos.zig` calls +`writeFileBytes` and `writeFd` live in `dev/host_io.zig` and are shared with +the tui shell and the SDL shell; `runtime/macos.zig` calls them (`:1807`, `:1823`, `:1848`, `:1863`) and its own copies, together with the four `extern "c"` declarations they needed (`forkpty`, `execv`, `chdir`, `_exit`), are gone. Two `extern "c"` declarations remain here: `setenv`, and `pardes_host_watch_file`, which FileWatcher.swift satisfies -(`src/macos.zig:40`, `:45`). The bug all four hosts' private `forkShell` +(`runtime/macos.zig:40`, `:45`). The bug all four hosts' private `forkShell` copies had in common is the argument for the shared file existing: none set `FD_CLOEXEC` on the pty master, so a program in one pane could read and write another pane's @@ -117,7 +117,7 @@ full mask is passed anyway to keep the signature whole. `pardes_scroll` carries fractional row and column deltas from a trackpad; the Zig side accumulates each axis separately and synthesizes whole `wheel_up`/`wheel_down`/`wheel_left`/`wheel_right` presses, because the core -scrolls on button events. `src/gui/gui.zig` (`takeScrollTicks`) does +scrolls on button events. `dev/gui/gui.zig` (`takeScrollTicks`) does exactly this already. A real mouse notch skips the smoothing and goes through `pardes_mouse`. `pardes_rotate` is the same shape for a two-finger twist, spent as `n`/`N` — see the trackpad section. @@ -142,7 +142,7 @@ pasteboard", with no payload either way, because the host answers by calling `pardes_paste` — and NSPasteboard being synchronous, that usually happens inside the callback itself, before it returns. Both are main thread, inside `pardes_tick`. There is no `open_url` callback because the core already opens -links itself through `/usr/bin/open` (`src/look.zig`), and no file callbacks +links itself through `/usr/bin/open` (`core/look.zig`), and no file callbacks because it owns the filesystem side too. **Lifecycle.** `pardes_init` returns 0 or an opaque nonzero code, @@ -156,7 +156,7 @@ Ordinary input and pty pumps never count as elapsed animation frames. The ordering contract is the part a header cannot enforce. **Init with the real grid size.** The core defers each integrated shell's greeting until it has seen -a resize: `sync()` in `src/pardes.zig` only emits the opening `ls` once +a resize: `sync()` in `core/root.zig` only emits the opening `ls` once `resize_count > 0` and parsed OSC 133 B says the prompt has handed the cursor to input. An unintegrated shell has no reliable readiness signal, so it skips the cosmetic greeting; an explicit command still releases after its successful @@ -484,7 +484,7 @@ has none: compares each member's `proc_pidpath` against the shell's own. A nested interactive shell is therefore still a prompt, and `bash -c 'sleep 30'` is still taken — the wrapper wears the shell's binary, but `sleep` shares its - group. The occupancy suite in `src/host_io.zig` runs on both platforms. + group. The occupancy suite in `dev/host_io.zig` runs on both platforms. ## Fonts and zoom @@ -493,7 +493,7 @@ reached differently on purpose. `Font ` and the `Fonts` picker are ordinary core builtins, enabled by `pardes.font_picker` — the frontends that draw their own text, which is now the -SDL shell and this one. `src/fonts.zig` moved out of `gui/` for that reason. It +SDL shell and this one. `dev/fonts.zig` moved out of `gui/` for that reason. It walks the platform's font directories and reads four small sfnt tables per file to decide whether every glyph has the same advance; no fontconfig and no CoreText, so both shells agree about which faces exist and disagree only about @@ -853,10 +853,10 @@ already do (`install_app_bin`, `install_plist`, `install_scene_kernel`, `install_icon`). - **The plist.** `plutil -replace LSMinimumSystemVersion` reads the committed - `src/macos/Info.plist` and writes a stamped copy into the cache. The source + `dev/macos/Info.plist` and writes a stamped copy into the cache. The source file is never mutated, which is what the old in-place `PlistBuddy` call did. - **The icon.** The mark is **Glenda**, the Plan 9 rabbit — pardes is an acme, - and acme is Plan 9's. `src/macos/icon.swift` is compiled alone (it is + and acme is Plan 9's. `dev/macos/icon.swift` is compiled alone (it is top-level code: one file, one module) and run with the bundle's `Resources` as its output directory. She is *drawn*, not traced: four overlapping ellipses filled as one path under nonzero winding for the silhouette, three @@ -886,9 +886,9 @@ already do (`install_app_bin`, `install_plist`, `install_scene_kernel`, ```sh swiftc <-O|-Osize|-Onone> -target -apple-macos13.0 \ - -import-objc-header src/macos/pardes.h \ + -import-objc-header abi/pardes.h \ -o /pardes \ - src/macos/Sources/{main,AppDelegate,PardesView,ScenePostprocessor,FileWatcher}.swift \ + dev/macos/Sources/{main,AppDelegate,PardesView,ScenePostprocessor,FileWatcher}.swift \ /libpardes.a -lc++ \ -framework AppKit -framework CoreText -framework CoreGraphics \ -framework CoreImage -framework Metal @@ -946,9 +946,9 @@ it goes. **The Linux dev loop.** The Zig half of this backend is plain POSIX, and most of it is no longer even this backend's: `forkShell`, `writeFileBytes` and -`writeFd` are `src/host_io.zig`'s, byte-identical on both systems, and what is +`writeFd` are `dev/host_io.zig`'s, byte-identical on both systems, and what is left that differs is `ioctl(TIOCSWINSZ)` (absent from `std.c.T` on darwin), -`/usr/bin/open` against `/usr/bin/xdg-open` (`src/look.zig:33-37`), and libproc +`/usr/bin/open` against `/usr/bin/xdg-open` (`core/look.zig:33-37`), and libproc against `/proc`. So `-Dplatform=macos` compiles on a Linux host, and its tests run there: @@ -962,7 +962,7 @@ functions precisely so that "how many notches is a 180° twist" is answerable on a machine with no trackpad in it. The header is kept honest with ghostty's trick. `build.zig` runs `translate-C` -over `src/macos/pardes.h` into the unit-test build, and `src/macos.zig` +over `abi/pardes.h` into the unit-test build, and `runtime/macos.zig` asserts every constant and every struct layout against the Zig side — the color tags, the attribute bits, the key codepoints, the mouse, modifier and haptic ordinals, `@sizeOf(pardes_cell_s)` and each field offset. A hand-written header @@ -1099,7 +1099,7 @@ used for the table and is not folded into the direct-path claim. `lsp`, one more response type. - **Detached sessions.** `Detach` (`SPC s D`), `Adopt` and `Upgrade` are compiled into the tui's and the window's builds alone (`enabled` is - `pardes.can_attach`, `src/builtins.zig`), and there is no daemon on macOS + `pardes.can_attach`, `core/builtins.zig`), and there is no daemon on macOS (`daemon.supported` is Linux and FreeBSD): this build's session is the one process it started, and closing it ends it. The `Attach` word and `src/detached/` it went through are gone (`docs/next-daemon.md`, "Phase 3 @@ -1125,7 +1125,7 @@ used for the table and is not folded into the direct-path claim. which is not where the time is, so the escalation is still not warranted. When it is, it is ghostty's: a `CAMetalLayer` installed into the view and driven from Zig, with the ABI growing one `platform` pointer field. -- **A Tahoe icon asset.** `src/macos/icon.swift` emits a full-colour `.icns`, +- **A Tahoe icon asset.** `dev/macos/icon.swift` emits a full-colour `.icns`, every one of the ten sizes, and that is the correct and only format at a 13.0 deployment target. macOS 26's Dock defaults to the `ClearAutomatic` icon style, which desaturates any icon that does not ship the new appearance diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 382b3098..d93cbbea 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -60,7 +60,7 @@ smallest common grid across them. - **Processes.** - The daemon is subreaper, spawner, fd holder, registry and 9P root. *Built otherwise:* fd holder and registry only, and the switchboard of - the replica socket; no subreaper, no spawner, no 9P (`src/daemon.zig` + the replica socket; no subreaper, no spawner, no 9P (`runtime/daemon.zig` "It spawns nothing and is nobody's parent"). - Every session is a child of the daemon: a GUI window, a tty session behind a stub, or a headless session. *Built otherwise:* none is; a @@ -115,7 +115,7 @@ smallest common grid across them. metadata. Blobs are pinned rather than copied. A file's text and its line index are neither: an edit writes them in place, and the copy's allocator notes what each write into one that was there took out, which - a rollback writes back, the newest first (src/rollback.zig `wrote`). + a rollback writes back, the newest first (core/rollback.zig `wrote`). - On a divergence it restores that copy, then replays the confirmed events and its own pending ones. - The authority never rolls back. @@ -203,7 +203,7 @@ open. ## Phase 3 notes -Built 2026-10-29 (`src/daemon.zig`, the tty and GUI hosts, `main.zig`). +Built 2026-10-29 (`runtime/daemon.zig`, the tty and GUI hosts, `main.zig`). Decisions taken at the forks, with the ponytail lens: - **Sessions are not the daemon's children; every one registers.** The @@ -308,7 +308,7 @@ child; `std.posix.tcgetattr` (an ioctl on that layout) is the right one. a view is indexed now, and a second local terminal or window is a replica client; the in-process extra views described here are gone.) -Built 2026-10-29 (`src/views.zig`, the tty and GUI hosts, `daemon.zig`, +Built 2026-10-29 (`core/views.zig`, the tty and GUI hosts, `daemon.zig`, the snapshot harness and the monkey). Decisions taken at the forks, with the ponytail lens: @@ -644,7 +644,7 @@ Everything of ours lives in `/root/pardes-test`, nothing outside it. ## Phase 1 notes -Built 2026-10-29 (`src/walk.zig`, `src/tape.zig`, the hooks across the +Built 2026-10-29 (`core/walk.zig`, `core/tape.zig`, the hooks across the core; `pardes-snap --tape`, `pardes-monkey --tape`, `zig build replay`). Decisions taken at the forks, with the ponytail lens: @@ -790,7 +790,7 @@ thread start in the render). ## Tty throughput notes -Found and fixed 2026-10-29 (`src/tui/tui.zig`, `waitInput`). +Found and fixed 2026-10-29 (`dev/tui/tui.zig`, `waitInput`). - **What the 1 GB `yes` cell measures is mostly the kernel.** A pty's output processing (ONLCR, a `\n` made `\r\n`) costs the writer about @@ -982,7 +982,7 @@ against that tty, is the Tty throughput notes' keystroke-to-present. ## Phase 5 groundwork notes Built 2026-10-29: the delay relay (`test/delay_relay.py`), the replica -socket (`src/daemon.zig`, `src/detached/wire.zig`), and two measurements +socket (`runtime/daemon.zig`, `src/detached/wire.zig`), and two measurements for open points 3 and 5 (`zig build rollback-bench`, which runs `test/rollback_bench.zig`, and `test/fork_stall.py`). Decisions taken at the forks, with the ponytail lens: @@ -1175,14 +1175,14 @@ What proved wrong in the design: ## Phase 5 part A notes Built 2026-10-29, in one process and with no transport: the rollback copy -(`src/rollback.zig`), the replica engine (`src/replica.zig`), the tape's -speculation mode (`src/tape.zig`), and an in-process harness +(`core/rollback.zig`), the replica engine (`core/replica.zig`), the tape's +speculation mode (`core/tape.zig`), and an in-process harness (`test/replicas.zig`, `zig build replicas`). `zig build rollback-bench` now times the real copy. Decisions taken at the forks, with the ponytail lens: - **The copy saves bytes and puts them back where they were.** Its walk - is the digest's (src/walk.zig): views, buffers, registers, counters and + is the digest's (core/walk.zig): views, buffers, registers, counters and terminal metadata. It saves the bytes of every allocation the walk reaches, and puts each back over its allocation. That works because the replica core's allocator (`rollback.Epoch`) changes three things while @@ -1220,7 +1220,7 @@ lens: and their answers, digests aside), the head goes: that is the fast path. The digests are left out of the comparison because the starting states are equal by induction. A digest checks every unit a replica replays. -- **Each client has its own view** (src/views.zig). The authority goes +- **Each client has its own view** (core/views.zig). The authority goes into the client's view before its input (`toView`, which is taped), and the replica's speculation does the same. So a unit records the switch only when another view was live, alike on both sides. The views not @@ -1345,7 +1345,7 @@ Not done, and why: ## Phase 2 notes -Built 2026-10-29 (`src/walk.zig` Dump/Load, `src/dump.zig`, terminal.zig's +Built 2026-10-29 (`core/walk.zig` Dump/Load, `core/dump.zig`, terminal.zig's dump hooks; `pardes-snap --dump`, `pardes-monkey --dump`, and both in `zig build replay`). Decisions taken at the forks, with the ponytail lens: @@ -1602,7 +1602,7 @@ output); a dump is off the hot path. ## Phase 5 part B terminal notes Built 2026-10-29: screen-state terminals wired into the replicas -(`src/screen_state.zig`, `src/replica.zig`, `src/tape.zig`, +(`src/screen_state.zig`, `core/replica.zig`, `core/tape.zig`, `src/terminal.zig`; `zig build replicas`). Transport-free: bytes in, bytes out, proven in part A's in-process harness; the remote agent's stream carries them. Decisions taken at the forks, with the ponytail lens: @@ -1902,7 +1902,7 @@ Follow-ups (2026-10-29): ## Phase 5 part B notes -Built 2026-10-29 and 30: the stream over the replica socket (src/replica.zig +Built 2026-10-29 and 30: the stream over the replica socket (core/replica.zig `Peers`, and its client half, `dial` and `readStream`; detached/wire.zig version 15), the client process (`pardes --attach=:` and `--attach=:`, tty.zig `remote`), the session's side of it in @@ -1958,7 +1958,7 @@ replica clients. Decisions taken at the forks, with the ponytail lens: - A dump-loaded client's emulators are on the C heap, as `terminal.create` makes a screen replica's (walk.zig `.alloc` of a pane's `terminal`, dump.zig `terminal_gpa`). -- **Predicted echo is the echo agent's** (src/echo.zig), wired as its +- **Predicted echo is the echo agent's** (core/echo.zig), wired as its notes say: the client's core points at its replica's `echo`, a frame judges it before drawing, and a wake comes a frame later while predictions are out. PARDES_NO_ECHO turns it off. @@ -2276,7 +2276,7 @@ Not done, and why: ## Phase 6: upgrade notes -Built 2026-10-29 (`src/upgrade.zig`, the tty and GUI hosts, `daemon.zig`, +Built 2026-10-29 (`runtime/upgrade.zig`, the tty and GUI hosts, `daemon.zig`, `main.zig`, `dump.resumeFromDump`; `test/daemon.py --upgrade`). A running session, and the daemon, move onto the pardes installed since they started, in place: text, undo, views and layout, terminals with their @@ -2536,8 +2536,8 @@ Not done, and why: ## Phase 6: 9P round trips notes -Built 2026-10-30 (`src/9p_io.zig` Client, `src/fs.zig`, the Mount word in -`src/builtins.zig`, a paragraph of `docs/typ/reference.typ`). pardes's own +Built 2026-10-30 (`runtime/9p_io.zig` Client, `core/fs.zig`, the Mount word in +`core/builtins.zig`, a paragraph of `docs/typ/reference.typ`). pardes's own 9P client is what mounts, the Mount word, the forwarding CLI, `--wait` and Handover use; scripting clients (9p(1), 9ns, test/ninep.py) are not changed here. Decisions at the forks, with the ponytail lens: @@ -2592,7 +2592,7 @@ changed here. Decisions at the forks, with the ponytail lens: 2 s budget again, as each Twrite already did. Found on the way: on main, every read of one operation shared one 2 s budget, so a remote file of 1.3 MB failed to open (`dial failed: timed out`) at 80 and 207 ms. On - the box without `-C`, the 77 KB `src/fs.zig` failed too. + the box without `-C`, the 77 KB `core/fs.zig` failed too. - **A mount keeps its connection** (`kept`), as Plan 9's mount keeps its channel: an operation through it is the flight alone, with no dial, version or attach. @@ -2719,7 +2719,7 @@ Not done, and why: ## Phase 6: predicted echo notes -Built 2026-10-30 (`src/echo.zig`; hooks in `src/replica.zig`; a field on +Built 2026-10-30 (`core/echo.zig`; hooks in `core/replica.zig`; a field on the core and one call at the end of `body_layer.renderBody`; `zig build replicas -- --echo`). Transport-free like part B: proven in part A's in-process harness, carried by the remote client. A key typed into a @@ -3028,7 +3028,7 @@ Installed 2026-10-30 05:27 into ~/.local/bin: pardes and pardes-gui ## Phase 6: content cache and zstd notes -Built 2026-10-30 (`src/replica.zig`: `Peer.farJoin`, the `Framer`'s +Built 2026-10-30 (`core/replica.zig`: `Peer.farJoin`, the `Framer`'s envelopes, `Have` and `Cache`; detached/wire.zig version 16; `walk.blobs`; tty.zig `remote`; main.zig `remoteAttach`; libzstd in build.zig). A far client, one through ssh, is sent a join's blobs by hash and only those it @@ -3315,8 +3315,8 @@ Not done, and why: ## Phase 6: GUI replica notes -Built 2026-10-30 (`src/gui/gui.zig` `remote` and the window session's -`Peers`, `src/replica.zig` `Link`, `src/views.zig` `within`, the +Built 2026-10-30 (`dev/gui/gui.zig` `remote` and the window session's +`Peers`, `core/replica.zig` `Link`, `core/views.zig` `within`, the `builtins.zig` registry's `here`, `Event.frontend`, wire 16; `test/daemon.py --window-clients`). A window is now a replica client, of a terminal's session or a window's, and a window's session serves replicas of @@ -3716,7 +3716,7 @@ both the rule already written above, broken at one site each. leader) ran with `ops == null` and defaulted its outcome, where the authority's was the kind's: mispredicted every time. Fix: one line at the top of `Kind.reopen`, which a Look's open, a revived placeholder and a - kind's reload all pass through. Test at the end of `src/replica.zig`. + kind's reload all pass through. Test at the end of `core/replica.zig`. - **A view's facts read derived state a joiner had not derived.** `Kind.viewOf` told a kind its view's body rows minus its bands, read from `Pane.notices` (the live view) or `Pane.pv[k].notices` (another), both @@ -3731,7 +3731,7 @@ both the rule already written above, broken at one site each. view and `collectNotices` assigns it. Replicating the notices was rejected: `draw.place` writes `pane.notices` outside a step, a divergence of its own waiting; it still does, harmless now that no fact - reads it. No wire or digest cost. Test at the end of `src/replica.zig`. + reads it. No wire or digest cost. Test at the end of `core/replica.zig`. - The rule, restated: a fact told to a kind, or to anything a digest covers, is derived again from dumped state at the call, never read from a copy a step or a park left behind. @@ -3884,7 +3884,7 @@ the session's step and its replicas' replay disagreed. None was a lag. ThemeFile, DumpThemes, Config, DumpConfig, an init file saved). **The model:** what only the authority holds stays the authority's, and a - step reads it through `tape.authority` (src/tape.zig): a `value` read, + step reads it through `tape.authority` (core/tape.zig): a `value` read, its answer taped; a replay takes the answer, and a speculation that reaches one waits for it, as at a host call (one RTT, never wrong). A replica's own store and Recent are never read by a step. Rejected: the @@ -3968,13 +3968,13 @@ the session's step and its replicas' replay disagreed. None was a lag. before the second write's clunk was answered, an `EOFError` the test takes for no `OSError`; twice again it passed. -Tests, each failing before its fix: src/rollback.zig ("a rollback leaves the +Tests, each failing before its fix: core/rollback.zig ("a rollback leaves the store and Recent as a speculation left them", "a view drawn outside a step -leaves the live view's slot holding nothing"), src/replica.zig ("a replica +leaves the live view's slot holding nothing"), core/replica.zig ("a replica joined after a pane closed", with the variant hunt's Recent written by another window; "a replica's Del of a file its session's Recent knows"; "a -client leaves, and one joins"), src/Places.zig ("a lowered copy's pieces not -searched yet are the same in every process"; src/replica.zig's "a step +client leaves, and one joins"), core/Places.zig ("a lowered copy's pieces not +searched yet are the same in every process"; core/replica.zig's "a step that reads a terminal's rows as the core keeps them"). The hunt's repros (`panes_closed.py`, `del_file.py`, `recent_store.py` with the client's own @@ -4207,10 +4207,10 @@ before it. ## Phase 6: instant interaction notes -Built 2026-10-30 (`src/replica.zig`, `src/tape.zig`, `src/terminal.zig`, -`src/echo.zig`, `src/detached/wire.zig`'s `stamp`, one line in -`src/pardes.zig`; PARDES_TEST_LATENCY's `I` and `U` lines in -`src/gui/gui.zig`). The user: "make sure to use the mosh +Built 2026-10-30 (`core/replica.zig`, `core/tape.zig`, `src/terminal.zig`, +`core/echo.zig`, `src/detached/wire.zig`'s `stamp`, one line in +`core/root.zig`; PARDES_TEST_LATENCY's `I` and `U` lines in +`dev/gui/gui.zig`). The user: "make sure to use the mosh tricks so that user interaction to type/scroll/move the cursor feels instant specially when they don't require a request going to the daemon", and "measure it too since I don't want to catch those myself". The @@ -4252,7 +4252,7 @@ Decisions at the forks, with the ponytail lens: - **No digest in a speculation.** A first version kept a terminal speculation's digest to check its unit's against; but a blob born under the copy and digested keeps its word past the epoch's free of - it (src/walk.zig), and a later blob at that address read as it (the + it (core/walk.zig), and a later blob at that address read as it (the harness's Debug blob check, seed 11 at 207 ms). Gone: it is confirmed by its records, as any speculation is. - **Never kept to replay later.** A unit confirmed on the fast path @@ -4446,7 +4446,7 @@ After the line, the hunt's H21 (a client's normal end aborted): 2.5 min, both end 0; 4 min at seed 32, four clients, none aborts (its one breach, a window's panes gone from its view, is not this one). -**A rejoin's view is its own again** (2026-10-30; `src/views.zig`'s +**A rejoin's view is its own again** (2026-10-30; `core/views.zig`'s `away`, `Pardes.awayView`/`rejoinView`, wire 19). Every rejoin gave the client a new view, a copy of the session's: a divergence's, and above all an Upgrade's, which every client makes after each install (the hunt's diff --git a/docs/next-drag.md b/docs/next-drag.md index 5871f785..cfaa6c69 100644 --- a/docs/next-drag.md +++ b/docs/next-drag.md @@ -42,7 +42,7 @@ window it goes to is found by asking every registry session. - `mouse.handleMouse`: a `.move` (pane grip) or `.column_move` (column grip) released outside goes to `Handover.begin` instead of the layout move. Inside the window the grip drag is exactly as before. -- `src/Handover.zig` (`Pardes.handover`), the core half: the pane with the +- `core/Handover.zig` (`Pardes.handover`), the core half: the pane with the panes attached to it (an attachment dragged alone goes alone, unattached), or the column, is dumped alone: `dump.dumpBytes(p, keep, carried)`, which `dumpState` now calls with no mask; `State.carried` (`pane`/`column`) diff --git a/docs/next-editor.md b/docs/next-editor.md index fdb656cb..120b4c09 100644 --- a/docs/next-editor.md +++ b/docs/next-editor.md @@ -11,7 +11,7 @@ same files with `pardes_config.lib` set; nothing is copied for it. ## The calls, as built -`library()` exports `pardes-editor` (src/lib_editor.zig) to a package that +`library()` exports `pardes-editor` (core/lib_editor.zig) to a package that passes `.editor = true` (it then fetches uucode, mvzr and vaxis, of which it compiles the grapheme width); a `pardes-syntax` package fetches what it did. The module has `pardes-syntax` in it as `.syntax`. @@ -92,7 +92,7 @@ share 0.5666 before, 0.5658 after. The Debug core-test binary grew from ## The seam, as built -- `Editor` (src/Editor.zig) is gathered per call: `p.editor()` in pardes, +- `Editor` (core/Editor.zig) is gathered per call: `p.editor()` in pardes, `Live.context` in the library. No field of `Pardes`, `View` or `Text` moved, so the dump is as it was (an embedded field would have renamed `registers` in it). diff --git a/docs/next-plumber.md b/docs/next-plumber.md index 178814b3..247d9928 100644 --- a/docs/next-plumber.md +++ b/docs/next-plumber.md @@ -43,7 +43,7 @@ including the user's uncommitted edits. No user rule exists today: the user's init has no `Plumb` line. Two tests pin the word: look.zig:2688 and test/behaviour/addons.zig:188. - **The design.** - - `src/Plumb.zig` owns the rules as text, which is replicated and dumped core + - `core/Plumb.zig` owns the rules as text, which is replicated and dumped core state, plus the ports this session has named. - Its matcher is a pure function of the rules and a message. The exceptions are `isfile`/`isdir`, which resolve a name exactly as Look does, through @@ -306,7 +306,7 @@ The hover, the n/N walk and lineSpan ask `resolve` what is lookable (look.zig:13 ### 3.1 Where the rules live -`src/Plumb.zig` is one type file owning its fields, with its tests at its end. +`core/Plumb.zig` is one type file owning its fields, with its tests at its end. ```zig //! The plumber (Plan 9's plumber(4), windows/plumb/): the rules, and a @@ -533,7 +533,7 @@ plumb to image ### 4.3 Where the default rules live -- **Location.** `src/plumbing`, the default rules file, compiled in with +- **Location.** `core/plumbing`, the default rules file, compiled in with `@embedFile`. `include basic` names it, as Plan 9's `include basic` names `/lib/plumb/basic`. - **Other includes.** Any other relative include is read from the configuration @@ -547,7 +547,7 @@ plumb to image - `plumb/rules`; - the `Plumb` pane (after `include basic`, the flattened rules are in `plumb/rules`); - - the reference, which quotes `src/plumbing` whole (§6). + - the reference, which quotes `core/plumbing` whole (§6). ## 5. Look after the plumber @@ -582,7 +582,7 @@ plumb to image - the `.diff` hook goes from the `.file` arm; - lookCommit goes from lookUnresolved. -### 5.2 The default rule file (`src/plumbing`), in full +### 5.2 The default rule file (`core/plumbing`), in full ``` # pardes's plumbing rules, in plumb(6)'s language. The first rule set @@ -712,9 +712,9 @@ no rule), Incl, `@p`, addresses, and the search. | the one definition | its sinks | |---|---| -| `src/plumbing` (embedded) | `include basic`; the boot rules; the reference's plumber section, which quotes the file. Typst reading `src/` from docs/typ is not verified; otherwise build.zig copies it next to the generated builtins JSON | +| `core/plumbing` (embedded) | `include basic`; the boot rules; the reference's plumber section, which quotes the file. Typst reading `src/` from docs/typ is not verified; otherwise build.zig copies it next to the generated builtins JSON | | `Plumb.text` (the rules in force) | `plumb/rules`; the `Plumb` pane's file after a save; a dump | -| Plumb.zig's table of pardes's own ports, each with a line saying what it does | `plumb/` readdir (with the ports rules named); the reference's port table; fs-help.txt's `plumb/` line (one line, as every directory has there, src/fs-help.txt:20-23) | +| Plumb.zig's table of pardes's own ports, each with a line saying what it does | `plumb/` readdir (with the ports rules named); the reference's port table; fs-help.txt's `plumb/` line (one line, as every directory has there, core/fs-help.txt:20-23) | | Plumb.zig's error words (Plan 9's) | `plumb/send` and `plumb/rules` write errors; the `Plumb` pane's save error; the reference | | the message's text form (one pack, one unpack in Plumb.zig) | `plumb/send`, the ports, a later `pardes plumb [-s src] [-d dst] [-w wdir] [-t type] [-a attr] -i \| data…` (plumb(1); PLAN.md §7 C+L's `fs write` over the tree) | @@ -727,7 +727,7 @@ lines of tests. - What it builds: - Plumb.zig: pack and unpack; parse, print, variables and include; expand; match, including click; dispose to `start` and to pardes's own ports; - - `src/plumbing`; + - `core/plumbing`; - `plumb/rules` and `plumb/send` in the tree; - the field `Core.plumber`. - Nothing calls the plumber from Look yet. External ports answer `no such plumb @@ -824,7 +824,7 @@ Decided 2026-11-17 by the coordinator, the user asked where marked: stays byte-identical. 3. **The `Plumb` word: (a).** Bare, it opens `/plumbing` as `Config` opens the init; Save applies it; an argument is refused in words. Without - that file the rules are `include basic`, the embedded `src/plumbing`. + that file the rules are `include basic`, the embedded `core/plumbing`. 4. **`plumb start` of a program: (a).** It runs as pardes's exec does: a builtin in place, a command as a command does today. The user has been asked whether a started program should run detached with no pane, as Plan @@ -909,7 +909,7 @@ The options as round 1 put them: - **Dumps and boot.** - How walk.Load treats the removed `plumb` field of an old dump. - Whether the init-file reapply call at host_io.zig:3006 is a taped input. - - Whether Typst can read `src/plumbing` from docs/typ. + - Whether Typst can read `core/plumbing` from docs/typ. - **Replicas.** That a replica's pushes to its own `p.fs` port queues are harmless. That is assumed from events.noteAction's pattern; replica.zig was not read for it. diff --git a/docs/next-run.md b/docs/next-run.md index 084f7c26..dc189bc6 100644 --- a/docs/next-run.md +++ b/docs/next-run.md @@ -37,8 +37,8 @@ The figure is `docs/next-run.typ`, drawn by `docs/typ/figures.typ` docs/next-run.svg`). Today `pardes attach` is four mechanisms, picked by the daemon's `find` -(`src/daemon.zig:901-972`) and by `main.zig`'s `attachTo` -(`src/main.zig:1774-1810`): a terminal handed to a detached terminal's +(`runtime/daemon.zig:901-972`) and by `main.zig`'s `attachTo` +(`runtime/main.zig:1774-1810`): a terminal handed to a detached terminal's session, which draws on it in its own process while the attach process waits as its stub; a window's detached session asked to open its own window again, while the attach process exits; a client here, when the diff --git a/docs/next-searchrows.md b/docs/next-searchrows.md index 79ffc444..2a139254 100644 --- a/docs/next-searchrows.md +++ b/docs/next-searchrows.md @@ -53,8 +53,8 @@ panes like @p1 but that resolves a Look". Change `tsyvmpux`, on ## Numbers -`zz grep rows timings` (src/Stream.zig, `GREP_TIMES=`): Debug, a -TestShell worker, 160x50, the stress file (src/layout.zig x17, 1.22 MB, +`zz grep rows timings` (core/Stream.zig, `GREP_TIMES=`): Debug, a +TestShell worker, 160x50, the stress file (core/layout.zig x17, 1.22 MB, 29002 lines), typing `pane` three times with 400 ms of frames after each key, then Enter on 2000 rows. Load 2.4-3.0 before, 2.7-2.8 after; after is three runs. diff --git a/docs/next-store.md b/docs/next-store.md index 3c8a2f7d..c8c2a6db 100644 --- a/docs/next-store.md +++ b/docs/next-store.md @@ -8,7 +8,7 @@ ## The decision (2026-11-05, the persistence step): everything on disk through xitdb -What pardes keeps on disk goes through xitdb (`src/Db.zig`; architecture +What pardes keeps on disk goes through xitdb (`core/Db.zig`; architecture §14): two files, both BLAKE3-keyed, both with xitdb's header-last commit, so a kill or a full disk leaves the last commit whole. diff --git a/docs/next-terminal.md b/docs/next-terminal.md index 2a8b61c3..26996897 100644 --- a/docs/next-terminal.md +++ b/docs/next-terminal.md @@ -22,7 +22,7 @@ Phase 2 (the terminal on the addon C ABI) and Phase 3 (shipping it as a `.so`) a ## What "leaner" means -"The core" is the `core_module` in build.zig: `src/pardes.zig` and everything it reaches. It is what `core-test`, hxdiff, perf, the benches and the test runners are compiled from, about 15 artifacts, each its own compilation. +"The core" is the `core_module` in build.zig: `core/root.zig` and everything it reaches. It is what `core-test`, hxdiff, perf, the benches and the test runners are compiled from, about 15 artifacts, each its own compilation. **Today `wireCore` (build.zig:835) gives it:** - cloud9, uucode, mvzr, xitdb, zstd; @@ -107,11 +107,11 @@ Items 1 and 3 were tried and reverted by the user's ruling (2026-11-16, "just ke - The undo of the edit copy is the core's, so its type moves to its user. This also clears the way for `pardes-editor` (the text library, reports/editor-lib.md:313). - Gate: core-test and hxdiff. -After 2 and the pager's move behind the interface, ghostty-vt is imported by the terminal's own files alone (terminal.zig, screen_state.zig, TerminalImages.zig, and the pager's parse in src/term/). +After 2 and the pager's move behind the interface, ghostty-vt is imported by the terminal's own files alone (terminal.zig, screen_state.zig, TerminalImages.zig, and the pager's parse in core/term/). ## Phase 0: the narrow module (no behaviour change, no ABI) -`src/term/` takes: +`core/term/` takes: - terminal.zig (3,422 lines); - screen_state.zig (1,664); - echo.zig (834); @@ -119,7 +119,7 @@ After 2 and the pager's move behind the interface, ghostty-vt is imported by the That is about 6,300 lines moved, not rewritten. -The rest of the core calls only the functions of one interface file. Its records are plain data: rows, numbers, bytes to write, cells. `src/Term.zig` is the suggested name: the core declares the interface and the module implements it. +The rest of the core calls only the functions of one interface file. Its records are plain data: rows, numbers, bytes to write, cells. `core/Term.zig` is the suggested name: the core declares the interface and the module implements it. **Today the core calls 62 terminal functions** (outside tests, by grep). They shrink as follows: @@ -156,7 +156,7 @@ The ptys stay host resources: ## Phase 1: the module leaves the core module - **The module.** - - `term` is a Zig module of its own, rooted in `src/term/`. Its imports are `std`, ghostty-vt, wuffs, zstbi, uucode and the interface module. + - `term` is a Zig module of its own, rooted in `core/term/`. Its imports are `std`, ghostty-vt, wuffs, zstbi, uucode and the interface module. - It does not import `pardes`. Zig refuses a file outside a module's root, so the build graph enforces the seam in both directions: the core cannot name ghostty, and the terminal cannot name the core. - The records the terminal writes (cells, placements) live in the interface module, or in a leaf module surface.zig's types are moved into. surface.zig today imports `pardes.zig` (surface.zig:3), so its cell types have to be lifted out. - **Registration.** @@ -183,20 +183,20 @@ The ptys stay host resources: What differs from the plan above, and why: - **The ops are a compile-time constant, not handed over at start.** - `Term.ops` (src/Term.zig:18) is `&@import("term").ops` when the build's + `Term.ops` (core/Term.zig:18) is `&@import("term").ops` when the build's `term_options.terminal` says the core has a terminal, null otherwise. Every core module but core-test's is given `term`; core-test's (`core_lean` in build.zig) is not, and its `term_options` say so. A run-time `Pardes.Options.terminal` would have put the table in every test's options and every host's start for no gain: no build ever has two terminals, and a null known at compile time drops the dead code. -- **The table**, `plain.term.Ops` (src/plain/term.zig): about 60 entries +- **The table**, `plain.term.Ops` (abi/term.zig): about 60 entries in the groups of Phase 0's table (lifecycle, output and view, input, prompt, text, the pager, draw, replicas), each taking and giving plain records or one of four opaque handles (`State`, `Encoder`, `Track`, `Replica`). The module fills it through a cast refused at compile time - unless each entry's signature matches (src/term/term.zig). -- **`Term.State` is a small struct around the handle** (src/Term.zig:55), + unless each entry's signature matches (core/term/term.zig). +- **`Term.State` is a small struct around the handle** (core/Term.zig:55), not the handle itself: walk.zig allocates a pane's terminal on load and hooks its digest and dump, and needs a type of the core's to do it on. The dump keeps a terminal as before (its `Parts` by name, then ghostty's @@ -205,7 +205,7 @@ What differs from the plan above, and why: name on load, so dumps of either build load in the other (checked: test/daemon.py --upgrade from a build of main, fc38c73c5, and from the Phase 0 base into this one, and from this one back to main's). -- **Predicted echo came back to the core** (src/echo.zig): it is the +- **Predicted echo came back to the core** (core/echo.zig): it is the replica's presentation, and reads the emulator through five entries (`grid`, `modes`, `prompt`, `echoCell`, `markRead`). - **The draw group is plain data** (Phase 0 left it typed in the core's @@ -213,10 +213,10 @@ What differs from the plan above, and why: the view's rows the body shows (painting the whole view cost a frame of the perf harness's `render` 82 -> 127 µs: a 3-row pane over a terminal still 37 rows tall, until the next update resized it), the - core lays it over the body (src/ansi.zig), and `Term.images` gives + core lays it over the body (core/ansi.zig), and `Term.images` gives placements. The colour filter stays the terminal's, as it wraps ghostty's `generate256Color`. A finished command pane's diff colours - (`DiffOutput`, `recolorDiffOutput`) moved beside it in src/ansi.zig. + (`DiffOutput`, `recolorDiffOutput`) moved beside it in core/ansi.zig. - **The no-terminal core** boots a scratch pane where a shell would be (Core.zig, `initSession`). `Term.open` refuses with `error.NoTerminal`, which a word says as "no terminal in this build" (`Term: …`, `exec: …` diff --git a/docs/next-tests.md b/docs/next-tests.md index 838202eb..2266b06a 100644 --- a/docs/next-tests.md +++ b/docs/next-tests.md @@ -13,7 +13,7 @@ agent's survey. The `e2e` line (kbdin, mousein) is its first step. `mousein`), the process (flags, daemon, attach, signals, terminal bytes), and files on disk and effects. A rewrite that keeps those keeps its tests. - **T1, in-process 9P, is the main tier.** The core is driven only through - `serveFs` (src/ninep/testing.zig's `call`, `rd`, `wr`): as behavioural + `serveFs` (core/ninep/testing.zig's `call`, `rd`, `wr`): as behavioural as a client on a socket, and milliseconds a case. - **One process runner, not Python (the user, 2026-11-04):** test/process.zig's `Process` starts `pardes` detached (over its socket), in a pty, or as the @@ -68,7 +68,7 @@ agent's survey. The `e2e` line (kbdin, mousein) is its first step. - **Fixed, found by running each case on the window:** - **A new terminal's first pty/run waited for ever:** after a resize, which a window always has, its greeting `ls` was typed at the same - first prompt (src/ninep/pty.zig). The run is now the shell's first + first prompt (core/ninep/pty.zig). The run is now the shell's first command. - **The canary's Newcol was refused:** the runner's 80x24 terminal had shrunk the window. @@ -193,9 +193,9 @@ test/behaviour/, plus the first process test. | area | moved | M left (most excluded: effects, T2, images, LSP) | X kept | |---|---|---|---| -| src/ninep/ctl.zig | 9 + 29 + 62 | 37 | 14 | -| src/ninep/pane.zig, test/panes.zig | 30 + 27 | 16 | 19 | -| src/pardes.zig, test/output.zig, test/pdf.zig | 28 + 14 + 21 | 13 | 51 | +| core/ninep/ctl.zig | 9 + 29 + 62 | 37 | 14 | +| core/ninep/pane.zig, test/panes.zig | 30 + 27 | 16 | 19 | +| core/root.zig, test/output.zig, test/pdf.zig | 28 + 14 + 21 | 13 | 51 | What the M left need, most first: - **Effects performed:** Session counts a save and drops it; a save diff --git a/docs/search-proto-converge.md b/docs/search-proto-converge.md index 7a3e361a..ddc41196 100644 --- a/docs/search-proto-converge.md +++ b/docs/search-proto-converge.md @@ -15,11 +15,11 @@ only the prompts that are not search. | piece | file | lifted from | |---|---|---| -| attached panes: a group under its owner, rows from the owner alone, moving/folding/closing with it, seam drag, Dump/Restore, `Unattach` | `src/layout.zig` "Attached panes", `Pane.attached_to` | attached | -| places: every match tinted, rail ticks (B1 on a tick goes there), current selected and in view, smart-case regex, view-first sliced scan, silent wrap | `src/Places.zig`, `Pane.places` | incsearch (MatchSet) | -| the query pane: line 1, its first word the source, live rows, preview, Enter/Esc/Del, reuse, settings | `src/Query.zig`, `Pane.query` | queryline, pick, live, preview, everywhere | -| fuzzy names (files, recent, panes, declarations) | `src/Names.zig` | pick (its scorer, whole) | -| the disk engine: Grep and Find's listing on a worker, rg or the walk, generations, debounce, cap + `More`; and the declarations parse | `src/Stream.zig`, `Pardes.stream` | stream | +| attached panes: a group under its owner, rows from the owner alone, moving/folding/closing with it, seam drag, Dump/Restore, `Unattach` | `core/layout.zig` "Attached panes", `Pane.attached_to` | attached | +| places: every match tinted, rail ticks (B1 on a tick goes there), current selected and in view, smart-case regex, view-first sliced scan, silent wrap | `core/Places.zig`, `Pane.places` | incsearch (MatchSet) | +| the query pane: line 1, its first word the source, live rows, preview, Enter/Esc/Del, reuse, settings | `core/Query.zig`, `Pane.query` | queryline, pick, live, preview, everywhere | +| fuzzy names (files, recent, panes, declarations) | `core/Names.zig` | pick (its scorer, whole) | +| the disk engine: Grep and Find's listing on a worker, rg or the walk, generations, debounce, cap + `More`; and the declarations parse | `core/Stream.zig`, `Pardes.stream` | stream | | the finder column (`SearchPlace column`) | `src/Finder.zig`, `Pardes.finder` | column | ## Semantics @@ -136,7 +136,7 @@ preview at the key that asked. ## Storyboards -Text: `/` in the 1.2 MB stress file (playground `src/layout.zig` x23), +Text: `/` in the 1.2 MB stress file (playground `core/layout.zig` x23), cursor on line 15000. | step | the screen | @@ -156,10 +156,10 @@ playground's root (the snapshot `find.snap` runs the same steps). | step | the screen | |---|---| | `SPC f f` | The query pane under the pane with its +Preview under it, both out of that pane's rows; line 1 `Find `; the 15 files below the directory listed at once (rg `--files` on the worker; dot-files like `.fill-section.py` and .gitignore'd ones passed over), the first current; tag `1/15`. | -| keystroke 1, `l` | The names scored fuzzily (pick's scorer: segment starts, basename, camel humps), best first, the matched letters tinted: `src/layout.zig`, `src/locations.zig`, `open-all.sh`, `notes/helix-keys.md`, ...; the best current, its head in the +Preview; tag `1/7`. | -| keystroke 2, `a` | `la`: `src/layout.zig`, `src/locations.zig`; tag `1/2`, layout.zig's head in the preview. Nothing moves. | -| Ctrl-n / Ctrl-p | `src/locations.zig` current, its head in the preview. | -| Enter | The preview becomes `src/locations.zig`'s pane where it stands (same rect and serial); the list frozen above it. | +| keystroke 1, `l` | The names scored fuzzily (pick's scorer: segment starts, basename, camel humps), best first, the matched letters tinted: `core/layout.zig`, `core/locations.zig`, `open-all.sh`, `notes/helix-keys.md`, ...; the best current, its head in the +Preview; tag `1/7`. | +| keystroke 2, `a` | `la`: `core/layout.zig`, `core/locations.zig`; tag `1/2`, layout.zig's head in the preview. Nothing moves. | +| Ctrl-n / Ctrl-p | `core/locations.zig` current, its head in the preview. | +| Enter | The preview becomes `core/locations.zig`'s pane where it stands (same rect and serial); the list frozen above it. | | `n` / `N` | In the query pane: the next / previous name current, shown in a new preview under it (or in its pane when open). In the opened file: helix's register search (a list of names has no places in a text). | | Esc (typing) | The query pane and its preview closed, their rows back to the pane that asked; nothing opened. | diff --git a/docs/selections.md b/docs/selections.md index f1d899a8..d8ad54c9 100644 --- a/docs/selections.md +++ b/docs/selections.md @@ -8,7 +8,7 @@ at `694e7dfdd`, upstream `278b24389`. ## What a selection is -Every `Text` (src/Text.zig) has its own: a pane's body, its tag, a prompt's +Every `Text` (core/Text.zig) has its own: a pane's body, its tag, a prompt's answer, a column's or the workspace's tag. A selection is one primary range plus others, up to `memory.limits.selections` in all (1024). diff --git a/docs/shared-libs.md b/docs/shared-libs.md index 79d393e7..79058973 100644 --- a/docs/shared-libs.md +++ b/docs/shared-libs.md @@ -105,8 +105,8 @@ and gui columns are the two binaries. | Regex | mvzr | pardes | 1 → 1 | 17 KiB | Zig | | Parsing | tree-sitter | pardes | 1 → 1 | | `ts_set_allocator` → c_heap | | Window, input, GPU | SDL 3.4.18 | gui | 1 → 1 | 1009 KiB | `SDL_SetMemoryFunctions` | -| Compress and decompress a far replica's stream (2026-10-30) | zstd 1.5.7 (the upstream tarball; build.zig compiles its lib/: no assembly, no threads, the dfast and lazy block compressors alone) | src/replica.zig | 0 → 1 | 380 KiB tty (516 with every block compressor) | `ZSTD_customMem` → c_heap | -| On-disk databases: the state file (Recent, the dumps) and a far client's blob cache (2026-11-05) | xitdb (pure Zig, a pinned commit of github.com/xit-vcs/xitdb, MIT) | src/Db.zig | 0 → 1 | | Zig: it allocates through the allocators it is given (a database's buffer, a read's), so it has no hook of its own; no C | +| Compress and decompress a far replica's stream (2026-10-30) | zstd 1.5.7 (the upstream tarball; build.zig compiles its lib/: no assembly, no threads, the dfast and lazy block compressors alone) | core/replica.zig | 0 → 1 | 380 KiB tty (516 with every block compressor) | `ZSTD_customMem` → c_heap | +| On-disk databases: the state file (Recent, the dumps) and a far client's blob cache (2026-11-05) | xitdb (pure Zig, a pinned commit of github.com/xit-vcs/xitdb, MIT) | core/Db.zig | 0 → 1 | | Zig: it allocates through the allocators it is given (a database's buffer, a read's), so it has no hook of its own; no C | Text section: tty 61,369,343 → 61,294,855 bytes (**−74,488**); gui 67,336,392 → 67,182,000 bytes (**−154,392**). diff --git a/docs/typ/README b/docs/typ/README index 641343f1..88f24343 100644 --- a/docs/typ/README +++ b/docs/typ/README @@ -14,7 +14,7 @@ docs/typ: the Typst documentation corpus file imports the figure it shows from here. cheatsheet-a4.typ output wrapper: the one-page A4 cheatsheet. book.typ output wrapper: an A4 book, title page, contents, - every chapter, then the tutor (src/tutor.txt). + every chapter, then the tutor (core/tutor.txt). ../site/site.typ output wrapper: the website, a page per chapter plus the landing page and the tutor, in one Typst bundle run (see docs/site/README). @@ -36,7 +36,7 @@ Build (from the repo root): typst compile --root . --ignore-system-fonts docs/typ/book.typ typst compile --root . --format bundle --features bundle,html docs/site/site.typ OUT zig build site -Dplatform=tui --prefix DIR # DIR/share/doc/pardes/site/ -(--root . because book and HTML read the tutor from src/tutor.txt.) +(--root . because book and HTML read the tutor from core/tutor.txt.) The contract for content files ------------------------------ @@ -113,7 +113,7 @@ builtins-tui.json and builtins-gui.json are every builtin of the terminal and the window build (name, leader, Help's other shortcuts, arg, scope, setting, choices, doc), written by `zig build builtins-json -Dplatform=tui` and `-Dplatform=gui` from the registry and the Help rows -(src/builtins_json.zig). style.typ merges them, marking each word "both", +(core/builtins_json.zig). style.typ merges them, marking each word "both", "tui" or "gui". The doc steps refresh their build's file first, and each build's unit-test fails when its file is stale. #word takes a name from either file. builtins.typ draws it as the @@ -123,7 +123,7 @@ in what order. The drift test -------------- The unit test "docs/typ names only words, keys and default tags that -exist" (src/config.zig) reads every .typ here and fails when a word(), +exist" (core/config.zig) reads every .typ here and fails when a word(), key(), keys() or tag() names a builtin, key binding or default tag that pardes no longer has. Pass these functions string literals, so the test can read them. diff --git a/docs/typ/book.typ b/docs/typ/book.typ index b2245372..668b47a3 100644 --- a/docs/typ/book.typ +++ b/docs/typ/book.typ @@ -1,7 +1,7 @@ // The book: every topic in reading order, then the tutor. Facts live in the // content files named by `chapters` in style.typ; this is layout only. // typst compile --root . --ignore-system-fonts docs/typ/book.typ -// (--root . because the tutor is read from src/tutor.txt.) +// (--root . because the tutor is read from core/tutor.txt.) #import "style.typ": palette, mono, chapters, tutor-path, doc-links, tagline #set document(title: "pardes") diff --git a/docs/typ/building.typ b/docs/typ/building.typ index 9026aa4f..5273298e 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -76,7 +76,7 @@ must share with its session; `pardes --help` lists every flag. == As a library A Zig package that depends on pardes is given one module and nothing of -the editor: `pardes-syntax` (`src/lib_syntax.zig`), for a program that +the editor: `pardes-syntax` (`core/lib_syntax.zig`), for a program that draws source text itself and wants it parsed and coloured as pardes has it. @@ -118,7 +118,7 @@ package, and `zig build lib-test` builds and runs it. === The editor -`pardes-editor` (`src/lib_editor.zig`) is the text pane as a library: +`pardes-editor` (`core/lib_editor.zig`) is the text pane as a library: helix's keys on a text kept in memory, no files, commands, builtins, prompts or views. A package asks for it, and is then given uucode, mvzr and vaxis's grapheme width besides; one that does not fetches nothing more. @@ -161,7 +161,7 @@ zig build core-test core tests on the core without a terminal (no ghostty that needs a terminal skips; the one to iterate on zig build shell-test the same tests and the native shell's, with the terminal, without the perf gate -zig build term-test the terminal module's own tests (src/term/) +zig build term-test the terminal module's own tests (core/term/) zig build pane-test pane, output and namespace integration tests zig build kitty-test kitty graphics conformance of terminal panes, at the core zig build kitty-harness kitty graphics through a pane end to end (a fake kitty @@ -209,7 +209,7 @@ zig build cheatsheet render the cheatsheet PDF (needs typst) [--replay-with=]` records and replays the tty cases' real sessions, their shells' and files' answers on the tape. - The tutor's practice blocks (`# keys:`, `# before`, `# after` in - `src/tutor.txt`) are typed by hand; nothing runs them. What pins that + `core/tutor.txt`) are typed by hand; nothing runs them. What pins that behaviour is `hxdiff`, which replays `test/hxcases` against goldens recorded from a real helix, and its `--parity`, which runs each case in a file pane and in a shell and demands they agree. @@ -278,12 +278,12 @@ effects such as spawning processes. decides who serves it. - The root module is chosen by platform: `main.zig` (tui, gui), `macos.zig`. The macOS shell is a library whose host owns `main()`. -- The terminal is a module of its own, `term` (`src/term/`): the +- The terminal is a module of its own, `term` (`core/term/`): the emulator (ghostty-vt), kitty images (wuffs, zstbi), the pager's parse and the replicas' screen state. It never imports the core; the core - reaches it through one table of plain-data entries (`src/plain/term.zig`, - through `src/Term.zig`), chosen at compile time. The records both name - (cells, colours, keys) are `plain` (`src/plain/plain.zig`, std only). + reaches it through one table of plain-data entries (`abi/term.zig`, + through `core/Term.zig`), chosen at compile time. The records both name + (cells, colours, keys) are `plain` (`abi/plain.zig`, std only). Every product is built with the terminal; core-test's core is built without it, so its compile names no ghostty, wuffs, zstbi or C++. - `memory.limits` is the one home for the core's capacities (selections, @@ -291,13 +291,13 @@ effects such as spawning processes. allocator is a DebugAllocator over its arena's reserved region, thread safe, its checks in Debug builds only. -Code map: `src/panes.zig` and the pane kinds it names (`src/File.zig`, -`src/Terminal.zig`, ...), `src/layout.zig`, `src/fs.zig` (host access, -mounts and resolution) and `src/pardes.zig` (input), with one file per +Code map: `core/panes.zig` and the pane kinds it names (`core/File.zig`, +`src/Terminal.zig`, ...), `core/layout.zig`, `core/fs.zig` (host access, +mounts and resolution) and `core/root.zig` (input), with one file per thing beside them (`edit.zig`, `normal.zig`, `look.zig`, `exec.zig`, -`mouse.zig`, ...). `src/ninep/` is the control tree, `src/daemon.zig` the -per-user daemon and a terminal's stub, `src/wire.zig` the input -wire a remote client will speak, `src/lsp/` the +`mouse.zig`, ...). `core/ninep/` is the control tree, `runtime/daemon.zig` the +per-user daemon and a terminal's stub, `abi/wire.zig` the input +wire a remote client will speak, `core/lsp/` the language-server client; `test/` holds harnesses, goldens and helix cases, `build/` the process tests' build steps. @@ -318,7 +318,7 @@ edit) the file's revision reject a stale reply. A process that never calls == The daemon and detached sessions -One `pardes --daemon` per user (`src/daemon.zig`) listens on +One `pardes --daemon` per user (`runtime/daemon.zig`) listens on `pardes-daemon.sock` in the runtime directory, its `.lock` flocked for its life; the first session that finds none starts it (a double fork and an exec) and it exits a second after it holds nothing. It is nobody's parent: @@ -343,7 +343,7 @@ own process, ended by its hangup. A replica (a client running its own copy of the core, phase 5 of `docs/next-daemon.md`) connects to `pardes-replica.sock`, a stream socket -beside it that `ssh -L` can forward. `src/wire.zig` is its +beside it that `ssh -L` can forward. `abi/wire.zig` is its protocol (its `version`): fixed-width little-endian fields, a 5-byte header (tag, then a u32 length), the hello, a ping, the input events. The hello names a session and carries the client's semantics hash (the protocol, @@ -354,9 +354,9 @@ nobody has, in words, and hands an accepted connection to its session (`SCM_RIGHTS`), which welcomes it and from then on is the one it talks to: the session sends the dump the client loads, then each step's tape and its terminals' screens, and the client sends its inputs -(`src/replica.zig`; #doc("running") draws it). +(`core/replica.zig`; #doc("running") draws it). -#word("Upgrade") (`src/upgrade.zig`) execs the path the session was started +#word("Upgrade") (`runtime/upgrade.zig`) execs the path the session was started from, at a step boundary, after asking it `--version`: the session's dump is committed to the state file as `upgrade-` (the build before wrote `pardes-upgrade-.dump`, which this one still reads, for one release), and its pty masters, @@ -383,10 +383,10 @@ shared code. - The engine (`fs.Server`) owns fids, permissions, directory reads, flushes and what a hangup releases; it allocates nothing and makes no OS - calls. The control tree in `src/ninep/` is its backend: `tree.zig` + calls. The control tree in `core/ninep/` is its backend: `tree.zig` (nodes, dispatch), `pane.zig`, `ctl.zig`, `cols.zig`, `addr.zig`, `pty.zig`, `events.zig` (event and log), `screen.zig`, `sources.zig`. - `src/9p.zig` names the editor's engine settings: msize 65536, 256 fids, + `runtime/9p.zig` names the editor's engine settings: msize 65536, 256 fids, 128 held reads a connection, names up to 255 bytes. - A read, write, open, clunk, remove or truncating wstat can park; a walk, attach, stat, create or rename cannot. Every Rread is clamped to the diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 9bbdba65..e69c756a 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -395,7 +395,7 @@ Shell zsh #word("DumpConfig") opens every live setting as the line that sets it. #word("Dump") saves the workspace and #word("Restore") brings it back (what a dump keeps is in the reference). Keys are compile-time, in -`src/config.zig`. +`core/config.zig`. = Questions @@ -409,6 +409,6 @@ Shell zsh pass kitty's protocols, #key("Shift-Esc") is a plain Esc and images draw as glyph art. / Does my helix config carry over?: No. The keys are compiled in - (`src/config.zig`); `~/.config/helix` is not read. + (`core/config.zig`); `~/.config/helix` is not read. / How do I quit?: #key("SPC q"), or #word("Exit") in any tag. / What does "pardes" mean?: The name of the four levels of reading a text in rabbinical exegesis (#link("https://en.wikipedia.org/wiki/Pardes_(exegesis)")[Wikipedia]). diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 47014d1b..2562c91b 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -17,7 +17,7 @@ it names, or else run it as a shell line. The files #file("look") and = The tree #fstree(``` -README the one-screen summary (src/fs-help.txt) @other-files +README the one-screen summary (core/fs-help.txt) @other-files index a line per pane: serial kind dirty name column @rules status pid, version, panes @other-files look write a line: a #word("Look") at the pane with the keyboard; read: the serials touched @look-and-exec @@ -378,7 +378,7 @@ takes (#word("Theme") `orchard`, #word("Verbose") `on`, #word("DumpDir") `` frontend lacks as a comment (`# GripWidth unsupported`), so writing back what it reads changes nothing. Writes take settings and session builtins (`scope = .session` in -`src/builtins.zig`), acting at the pane with the keyboard: +`core/builtins.zig`), acting at the pane with the keyboard: - A setting written bare steps to its next value (a switch flips). A value it does not take is `bad value in control message; ...` naming what it takes; @@ -487,9 +487,9 @@ rows) and the window's caret eases to its place. may lower the contrast of text, the selection or a focus indicator. Resting the pointer on text for about 32 ms (`look_preview_delay_frames`, -2 frames, in `src/config.zig`; `null` turns it off) tints what #word("Look") would take, with no other effect. A terminal's or a `+Pager`'s +2 frames, in `core/config.zig`; `null` turns it off) tints what #word("Look") would take, with no other effect. A terminal's or a `+Pager`'s #word("Filter") keeps each foreground at least `tty_filter_min_contrast` -(WCAG 1.5, `src/config.zig`) against its background. +(WCAG 1.5, `core/config.zig`) against its background. = Columns and tags @@ -735,7 +735,7 @@ over the match where the search starts. Patterns are mvzr's (classes, `\d\w\s`, `{m,n}`, lazy `*?`), searched as sam searches, line by line: `^` and `$` match at any line's start and end, `.`, `\s` and `[^...]` never match a newline (helix's `\s` and `[^...]` do: -there `S\s+` splits off a line's newline, here `S\s+|\n` does). The same code (`src/regexp.zig`) +there `S\s+` splits off a line's newline, here `S\s+|\n` does). The same code (`core/regexp.zig`) serves addresses, #word("Edit"), and normal mode's #key("s") and #key("S"). The ceiling: @@ -1040,7 +1040,7 @@ own: a file or directory opened, else the word searched for. place. A session starts with the plumbing file's rules, #word("Plumb") (`plumbing` in the configuration directory, beside `init`; saved, its rules are in force), or without one `include basic`, pardes's own - (`src/plumbing`, below). A write adds rule sets, each + (`core/plumbing`, below). A write adds rule sets, each read as its blank line comes, the rest at the close (refused there, it is an `err` in the log alone; Plan 9's loses it); `>` replaces them all. One open writes at a time (`file in use`). Kept in a dump. @@ -1050,7 +1050,7 @@ own: a file or directory opened, else the word searched for. were. `$1`-`$9` are refused: pardes's regular expressions (#doc("reference", section: "regexp")) have no submatches; write `$0` and several `matches`, as Pike's two patterns do. `include basic` is - `src/plumbing`; another name is the configuration directory's file, an + `core/plumbing`; another name is the configuration directory's file, an absolute one where it says. - #file("/plumb/send") takes a message, plumb(6)'s six lines (`src`, `dst`, `wdir`, `type`, `attr`, the data's length) and then the data, @@ -1095,7 +1095,7 @@ own: a file or directory opened, else the word searched for. that wants one says `sh -c '...'`); a failure to start it is said, and logged as an `err`. Its directory and words fit in 256 bytes. -The default rules, `src/plumbing`, keep #word("Look")'s ways: a URL to +The default rules, `core/plumbing`, keep #word("Look")'s ways: a URL to the browser; a bare `.diff` or `.patch` stacked in a +Diff (#word("Diff") with the file, which declines one with no hunk, opened as text then); an existing directory or file to `edit`, Look's own open (a kind's file in @@ -1106,18 +1106,18 @@ sends to `edit` (`src` `pager`, `type` `text/x-diff`, `action=showdata` and the +Pager's `filename`), made `showdiff`: stacked in a +Diff in the +Pager's place. Text paged that is no diff is not sent: -#raw(read("../../src/plumbing"), block: true) +#raw(read("../../core/plumbing"), block: 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`, +game, a plot. It is written against one header, `abi/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, memory that outlives a call, a job off the loop, a Look or an Exec, a message, a new text pane, its selection) it is handed at load. `addons/fake/fake.c` uses every function; a kind with only a head and -`paint` is a valid one. In Zig, `src/kinds/addon.zig` (over the same +`paint` is a valid one. In Zig, `abi/addon.zig` (over the same header, and nothing of the core) makes the `pa_ops` from a struct of the functions a kind has (`pub const pardes_addon = addon.ops(Snake);`, and `addon.exportLib(&pardes_addon)` in a `comptime` block, which exports it @@ -1129,7 +1129,7 @@ and views, a window to `put` text in (column first, where the header's every tick, a body written (at most 4 KiB) or held (any length), an `init` at load, a struct's bytes as its record, and its own `zig test` (`zig build addon-test` runs them); a Zig kind outside the tree runs `zig -translate-c src/kinds/pardes_addon.h` once for the header: +translate-c abi/pardes_addon.h` once for the header: `addons/snake/snake.zig` is a game in it. Pictures are an addon too, `addons/image/image.zig` (PNG, JPEG, GIF, BMP, PPM, PGM and TGA through stb_image, at most 1280 pixels a side), which `zig build image` diff --git a/docs/typ/running.typ b/docs/typ/running.typ index 01fb7f32..7e0d16d4 100644 --- a/docs/typ/running.typ +++ b/docs/typ/running.typ @@ -185,7 +185,7 @@ of the session or a divergence of its own. `pardes attach /run/x.sock:work` // only); main.zig:1544-1560 (no daemon reached: no fork); tui.zig:1352-1353, // gui.zig:2483, host_io.zig:227 (Detach and Adopt refused); // replica.zig:1900-1905 (a client only through the daemon); -// pardes.zig:113 (can_attach); main.zig:1498-1500 (a far attach needs no +// core/root.zig:117 (can_attach); runtime/main.zig:1498-1500 (a far attach needs no // daemon here). With `PARDES_DAEMON=off`, in a window under test (`PARDES_TEST`), where none could start, and in the Mac's own build, the session is the process diff --git a/docs/typ/style.typ b/docs/typ/style.typ index 5a482cd8..bf005c63 100644 --- a/docs/typ/style.typ +++ b/docs/typ/style.typ @@ -5,7 +5,7 @@ // elements and classes for a stylesheet. Page geometry and fonts belong to // the output wrappers beside this file. -/// The `atelier` theme (src/themes/atelier.zig): pardes's acme homage, +/// The `atelier` theme (core/themes/atelier.zig): pardes's acme homage, /// butter paper and blue-green tags. #let palette = ( paper: rgb("#fffdeb"), @@ -67,7 +67,7 @@ #let tagline = "acme's tags and three buttons, helix's keys, terminals as panes, the editor as a virtual filesystem over 9P" /// The tutor, shown as it is in the editor (`Tutor`), from the repo root. -#let tutor-path = "/src/tutor.txt" +#let tutor-path = "/core/tutor.txt" /// How much room tables and shell lines get: "roomy" (the book, the HTML) /// or "tight" (the A4 sheet sets it). @@ -180,13 +180,13 @@ /// A tag word or builtin, drawn as a thing to click: the tag's ground and /// ink in the tag's monospace, over a rule. Look and Exec take acme's look -/// and exec sweep colours (green and red, src/themes/acme.zig) for the +/// and exec sweep colours (green and red, core/themes/acme.zig) for the /// rule; every other word the tag's box colour. In HTML a , so a text browser still shows the plain word. #let word-accent = (Look: rgb("#006600"), Exec: rgb("#aa0000")) /// Every builtin of either build, written by `zig build builtins-json` -/// from the registry and the Help rows (src/builtins_json.zig), a file per +/// from the registry and the Help rows (core/builtins_json.zig), a file per /// build: name, leader, also (Help's other shortcuts), arg, scope, setting, /// choices, doc, and for a shipped addon's word its addon first. Merged here, each with `platforms`: "both", "tui" (the /// terminal only) or "gui" (the window only). @@ -310,7 +310,7 @@ (name: "git.0x4200.cafe", web: "https://git.0x4200.cafe/pardes", clone: "https://git.0x4200.cafe/pardes.git"), ), license: "ISC", - changes: "https://git.sr.ht/~gbrls/pardes/tree/main/item/src/CHANGELOG.md", + changes: "https://git.sr.ht/~gbrls/pardes/tree/main/item/core/CHANGELOG.md", // built binaries to download: the version they are, where the // checksums are, and a file per program (install.typ shows them) download: ( @@ -473,7 +473,7 @@ /// ends in `/`), two or more spaces, a one-line description, and an /// optional `@label` naming the section that documents it, which becomes /// a link wherever that section is in the same output. A description may -/// call #word, #key, #keys or #btn. src/config.zig's +/// call #word, #key, #keys or #btn. core/config.zig's /// test reads the same block in reference.typ against the served tree. #let fstree(spec, root: "/") = { // a description is text, unless it calls #word, #key or #btn -- cgit v1.3