ZTORRENT // ENGINEERING REPORT

// host structure · shared embeds · hook points · test status

Home GitHub

ztorrent is a thin Tauri v2 host: the window, the native menu bar, the shared embeds and the app shell. Every feature is a command on the ztorrent-core engine, and the client UI is that crate’s mountable view, vendored into frontend/ at build time.

Host structure

PieceWhat it does
app/src-tauri/src/lib.rsRegisters the engine bridge (ztr_invoke), the shared file-browser and terminal commands, the powerline stats command and the stryke hook runner; wires engine events to the webview
native_menu.rsTorrent / Queue / Session / Tools / View menus — verify, reannounce, rename, reveal, start-now, message log, statistics, compact view; every id round-trips to the same handler the ⌘K palette calls
bus.rsThe GUI Automation Bus socket, so App::open("ztorrent") can drive the app
stryke_runner.rs · stryke_lsp.rsRuns the app’s stryke lifecycle hooks and backs the hooks editor’s language server
frontend/main.jsMounts ZGui.appShell, feeds it the view’s palette, and renders Transmission’s preference groups — including remote control, power and the auto-assign Groups editor — into the shell’s one settings panel
frontend/ztorrent.jsThe client view itself — vendored from crates/ztorrent-core/webui, never forked

Shared modules it mounts

ModuleRole
zgui-coreThe widget toolkit and the app shell (palette, settings, colourscheme, splash, powerline, tmux tiling)
zpwr-embed-terminalThe PTY terminal pane (Ctrl+` / ⌘⌥T)
zpwr-file-browserThe multi-pane file browser overlay (⌘B) over the host’s fs backend
zpwr-hooks-editorThe Monaco stryke hooks editor (⌘⇧H)
zpwr-i18nThe interface localization runtime
zpwr-clip-engine · zwire-hostThe shared sequencer grid and the live system stats behind the powerline

Hook points

The app publishes five stryke hook points — torrent.added, torrent.completed, torrent.removed, seeding.stopped and altspeed.changed — so a script can move a finished download, notify something, or react to the scheduler flipping turtle mode. They are edited in the shared hooks overlay and run through the app’s stryke runner.

Test status

pnpm test runs both suites: 247 Rust tests in the engine and 17 headless webui tests, 264 in total. The webui suite asserts that every call goes through the ztr_invoke bridge and that the view feeds the host shell instead of binding a global key — the rule that keeps an embedded core from fighting its host for ⌘K.