Skip to content

v0.1.17

Choose a tag to compare

@github-actions github-actions released this 18 Nov 21:36
· 80 commits to master since this release
e652d02

Suwu 0.1.17

The terminal engine moved to libghostty-vt 1.0 (the official release, no more vendored
fork), the server stopped leaking sockets and memory, and a pasted log file no longer
kills the connection.

Terminal engine: libghostty-vt 1.0, official WASM build

  • Replaced the third-party wrapper (shintaoku/libghostty-go, a patched
    ghostty-1.3.0-dev built with Zig) with pkg/vt: a small binding to the official
    libghostty-vt 1.0.0
    C ABI, running the speed-optimized (ReleaseFast) upstream WASM
    artifact on wazero. The artifact is pinned by SHA-256 in pkg/vt/PROVENANCE.md and
    verified by a test; go.mod no longer depends on the wrapper.
  • Roughly 8× less memory per live terminal (≈11 MiB → ≈1.2–2.3 MiB idle), 6× faster
    instantiation, ~3.5× parser throughput. Two terminals now cost a few MiB, not tens.
  • Server-side screen dumps come from the 1.0 formatter with an explicit extras mask
    (0xC6), which reproduces the old bytes, so the browser replay path is unchanged.
  • A second terminal-engine benefit: the wasm module is compiled once and cached under
    the data directory (wasm-cache), so restarts no longer pay a ~0.6 s compile.

Terminal input: send any key, and paste anything

  • New "send a key" menu in the status bar, immediately left of the frequent-inputs
    bolt: type a combination (ctrl+shift+a), assemble it from key chips, or press it.
    Values render as pills so key names are legible, whitespace separates keys of a
    sequence (esc space b), and the exact bytes are shown before sending. Covers what the
    browser eats: Ctrl+Shift+letter, browser-reserved shortcuts, F1–F12, arrows with
    modifiers, Esc/Tab/Enter/Space. History of the last 24 sends, one click to
    replay.
  • Large pastes no longer drop the connection. A paste arrives as one WebSocket
    frame; the server refused anything past its 32 KiB read limit with
    StatusMessageTooBig, which the browser saw as a lost session. Input is now chunked
    into ≤16 KiB frames on the client and the server accepts up to 4 MiB per frame.
  • Fixed a session deadlock that a large paste into a redrawing app could trigger:
    input was written to the PTY while holding the manager's lock, so an application busy
    writing output (and therefore not reading input) froze the session — and every other
    session with it. Input now goes through a per-session queue drained by a lock-free
    writer.

Stability: leaks found and fixed

  • WebSocket leak (the big one). /ws/notify never read its socket, so a client that
    went away (a reaped tunnel connection, a closed tab) was invisible: the handler parked
    on a channel, the connection was never closed, and the session never detached. One
    deployment accumulated 2,244 leaked sockets and 3.7 GiB of RSS. The handler now has
    a reader and a 30 s ping, and every WebSocket write is deadline-bounded.
  • Notify socket stealing. A development suwu serve could unlink a running
    server's ~/.suwu/suwu.sock and bind its own; when it stopped, the path was deleted
    outright and suwu open/code/diff failed with "no such file" while the server kept
    running (unrepairable without a restart). Binding now probes the path first and
    refuses to take over a live socket, removal is identity-checked, and the path is
    per-instance: $SUWU_SOCK_PATH, else <data dir>/suwu.sock, else
    suwu-dev.sock when SUWU_DEV=true.
  • Session state polling no longer reads /proc for detached sessions (it was the
    largest allocator in the process, ~19 MiB/h of garbage for two idle shells) and reuses
    its read buffers: 5.3 KiB → 0.8 KiB per call.
  • Static assets are served from the compression cache without re-reading the file,
    which removed 65 % of the remaining allocation churn (a page load re-read ~7 MB of
    embedded assets every reload).

Diagnostics (opt-in, hidden flag)

suwu serve --pprof starts a loopback-only pprof listener (127.0.0.1:6060) and writes
a heap profile, a grouped goroutine dump and MemStats JSON under ~/.suwu/debug/ every
two hours (--heap-dump-interval, --heap-dump-keep). The snapshots now also record
open descriptors and live/attached session counts. The flags are deliberately absent
from suwu serve -h.

Dependencies, build and housekeeping

  • Go modules refreshed; wazero stays pinned at v1.11.0 because qjs v0.0.6 cannot run on
    v1.12+ (documented in go.mod).
  • Frontend dependencies refreshed (React 19.3, Vite 8.3, Tailwind 4.3, Biome 2.6, …) and
    the lockfile regenerated.
  • pnpm build (and start, build:max, build:ext) now run pnpm install first, so
    pulling a change that adds a dependency needs no separate step.
  • Biome 2.6 compliance: schema/preset migrated, and a component was hoisted out of a
    page render to satisfy noComponentHookFactories. This also turns CI green again.
  • Image lightbox for the file/dropbox viewer, plus a Suwu deck built by the Bento tile.

Upgrading

Nothing manual: the binary is self-contained. Two visible changes worth knowing:

  • If you run a development server on the same account as an installed service, it now
    uses suwu-dev.sock — CLI commands in a normal shell keep talking to the service.
  • A second suwu serve on the same socket path refuses to start (with an explanatory
    error) instead of silently taking the socket over. Set SUWU_SOCK_PATH if you need
    two instances with distinct data dirs.

Full changelog: v0.1.16...v0.1.17