samiandClaude Sonnet 5 eb72aa522c daemon: build velox-nmhost, systemd socket activation + units, velox(1) man page
Closes build order items 7 (the systemd half) and 9 (D11 in deferrals.md).

velox-nmhost (nmhost/src/main.cpp, 185 lines): a poll()-driven byte pump between
Firefox's native-messaging framing on stdio (4-byte native-byte-order length prefix)
and veloxd's own NDJSON framing on the Unix socket. Reframes each direction, no JSON
parsing, no retry/backoff (the extension relaunches a fresh host on its own
reconnect), exits the moment either side closes. Deliberately dependency-free — no
veloxd_* library, no nlohmann_json — since it runs unconfined outside Firefox's
sandbox regardless of packaging format.

Two real bugs found and fixed while getting the integration test to actually pass
rather than hang, both exactly the class of bug a "trivial pump" invites:
1. Never set the pumped fds non-blocking, so the "drain what's available" read loop
   blocked on its own second read() instead of returning to poll().
2. stdin and stdout are two different descriptors (0 and 1), not one — an early draft
   polled POLLOUT on fd 0, which is opened read-only, so EOF and writability were
   never both observable through the same pollfd entry.

packaging/nativehost/com.velox.host.json + its own README.md supersede
AGENT-DAEMON.md's stale "four locations" line: spike S1 / ADR 0003 found only three
manifest locations are real (~/.mozilla/native-messaging-hosts/ for BOTH deb/tarball
and snap Firefox, /usr/lib/mozilla/... for deb/tarball only, the flatpak sandbox path)
— the fourth, ~/snap/firefox/common/.mozilla/..., is not read by snap Firefox at all.
The README spells out the per-user-manifest / postinst enumeration implication for
PKG/QA (postinst runs once as root; the two ~/-relative locations are per-user) and
flags that docs/07-packaging.md's own install-layout line only shows the one
root-owned path.

Socket activation: rpc/systemd_activation.cpp is a from-scratch sd_listen_fds() (env
vars only — LISTEN_PID/LISTEN_FDS, fd 3 — no libsystemd link) that UdsServer::start()
checks first, skipping its own create/bind/chmod/listen when systemd already bound
the socket. packaging/systemd/velox.socket + velox.service are the unit pair,
verified both by systemd-analyze verify and by an actual fork/dup2/execve simulation
of the activation handshake — a real session.hello round-tripped over the handed-off
fd with no bind() ever called inside the daemon for that run. velox.service
deliberately skips ProtectSystem=/ProtectHome=/ReadWritePaths=: saveTo.allowedRoots is
user-configurable to anywhere on the filesystem, and a sandbox here would turn a
legitimately-configured save location into an opaque EROFS/EACCES instead of the
daemon's own clear -32011.

cli/man/velox.1 documents the CLI as it actually exists today (add/ls/pause/resume/rm,
--json) — the queue/settings subcommands AGENT-DAEMON.md's build order originally
sketched aren't implemented in cli/src/main.cpp yet, so the page doesn't claim they
are. Checked warning-free with groff -mandoc -ww -z.

Full ctest: 57/57 (excluding the pre-existing, unrelated conformance failure noted in
earlier commits).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GRDjHGgpYmMoPE2UFbe7pP
2026-09-12 22:46:52 +04:00
2026-09-12 11:05:07 +04:00

Velox Download Manager (VDM)

An IDM-class download manager for Ubuntu 26.04 LTS: multi-segment accelerated HTTP(S) downloading, resume, categories and automatic file distribution, queues and scheduler, speed limiter, a Firefox extension that captures downloads automatically, and clipboard link capture.

Name is a placeholder. Binaries are veloxd, velox-gui, velox, velox-nmhost. Rename before first release if you want something else — do it in M0, never later.


Status

Phase M0 — scaffolding. No implementation code exists yet. This repository currently contains the architecture, the wire contract, the roadmap, and one brief per build lane so that several agents can work in parallel without colliding.

Start here:

Document What it answers
docs/01-architecture.md Process model, why four binaries, framework choices and why
docs/02-roadmap.md Milestones M0M7, what runs in parallel, exit gates
docs/03-gui-spec.md IDM-parity UI: every window, dialog, column, menu
docs/04-engine-design.md Segmentation, resume, buffers, rate limiting, disk I/O
docs/05-extension-spec.md Firefox capture, transports, pairing, media grabber
docs/06-risks-and-spikes.md Snap Firefox, Wayland clipboard, and the other landmines
docs/07-packaging.md .deb/PPA, Flatpak, AMO signing, install layout
contracts/README.md The interface. Both sides build against this
CLAUDE.md Rules of engagement for agents working in this repo

Per-lane briefs live in docs/agents/ — one per agent, each with an owned directory list, a definition of done, and the files it must never touch. To dispatch the agents, use docs/agents/PROMPTS.md — six copy-paste prompts plus the worktree commands and the wave order.


Architecture in one picture

  ┌────────────────────┐   native messaging (stdio JSON)   ┌──────────────┐
  │  Firefox extension │◄─────────────  or  ──────────────►│ velox-nmhost │
  │       (MV3, TS)    │   loopback WS 127.0.0.1 + token   └──────┬───────┘
  └────────────────────┘                                          │
                                                                  │
  ┌────────────────────┐                                          ▼
  │  velox-gui (Qt 6)  │◄──── JSON-RPC 2.0 over Unix socket ──► ┌─────────────┐
  └────────────────────┘      $XDG_RUNTIME_DIR/velox/velox.sock │   veloxd    │
                                                                │  (daemon)   │
  ┌────────────────────┐                                        │             │
  │   velox (CLI)      │◄───────────────────────────────────────┤ libveloxcore│
  └────────────────────┘                                        └──────┬──────┘
                                                                       │
                                                              SQLite + sparse files

The daemon owns all state and all sockets. The GUI is a view — closing it does not stop a download. The extension never touches the disk; it hands URL + headers + cookies to the daemon and gets a task id back.


Repository layout

vdm/
├── contracts/          ⭐ Wire contract: JSON Schema, fixtures, codegen. Frozen per version.
├── core/               C++23  libveloxcore — engine. No UI, no RPC, no SQL.
├── daemon/             C++23  veloxd — RPC server, scheduler, queues, SQLite store.
├── gui/                C++23  velox-gui — Qt 6 Widgets, IDM-parity UI.
├── cli/                C++23  velox — scriptable client.
├── nmhost/             C++23  velox-nmhost — Firefox native-messaging bridge (thin pipe).
├── extension/          TS     Firefox MV3 WebExtension.
├── tools/
│   ├── mockd/          TS mock daemon — lets GUI + extension work before veloxd exists.
│   ├── testserver/     Deliberately hostile HTTP server (no Range, flaky, redirects, auth).
│   ├── bench/          Throughput and CPU benchmarks.
│   └── fuzz/           libFuzzer targets for parsers.
├── tests/
│   ├── conformance/    Protocol suite. Every lane must pass it. Gate for merging.
│   ├── integration/    veloxd + testserver.
│   └── e2e/            Playwright: real Firefox + real daemon + real file on disk.
├── packaging/          debian/, flatpak/, appimage/, native-host manifests.
└── docs/               Everything above, plus adr/ and agents/.

Toolchain bootstrap

Surveyed on this machine 2026-09-09 — most of it is already installed:

Present Version
git · cmake · ninja · g++ · gdb 2.53.0 · 4.2.3 · — · 15.2.0 (C++23 ready)
qt6-base-dev · qt6-tools-dev · qt6-tools-dev-tools
libcurl4-openssl-dev · libsqlite3-dev · nlohmann-json3-dev · libssl-dev
libavformat-dev · libavcodec-dev · ffmpeg
clang-format · clang-tidy · python3 · pkg-config
python3-jsonschema · python3-referencing (conformance static runner)

Only these four are missing:

sudo apt update && sudo apt install -y \
  qt6-svg-dev \       # GUI: SVG icon rendering
  libsecret-1-dev \   # DAEMON: Secret Service for site logins
  nodejs npm \        # EXT + PROTO: extension build, mockd, conformance runner
  clang               # optional: libFuzzer targets in M7

Node in the 26.04 archive may lag; if the extension toolchain needs 22+, use nvm.

Verify with cmake --preset dev && cmake --build --preset dev once lane CORE lands its first target. Note CMake 4.2.3 is installed — newer than the 3.28 floor in CMakeLists.txt, and it hard-errors on cmake_minimum_required below 3.5, so no dependency may ship a pre-3.5 CMake file.

S
Description
a download manager for ubuntu
Readme
1.4 MiB
Languages
C++ 69.9%
TypeScript 20.5%
Python 6.1%
CMake 1.9%
Shell 1.1%
Other 0.4%