lore-forge/.ai/designs/desktop-client.md

463 lines
30 KiB
Markdown

# Desktop client
Status: milestone 3 (locking, autosync and notifications) done on macOS, after milestone 2
(liblore in the service: real workspaces, the explorer on real data, sign-in through the forge,
clone, submit and sync). Last updated 2026-11-26.
lore-forge's desktop side: a tray application and a terminal UI for people working in Lore
repositories, both driven by one per-user **client service** that does the Lore work and runs
policies such as autosync.
## Decisions
| Decision | Choice | Source |
| --- | --- | --- |
| Shape | One per-user client service; the GUI and the TUI are frontends that connect to it | Owner, 2026-11-25 |
| How the service drives Lore | liblore, Lore's C API, pinned in `lore.lock` like the binaries | Owner, 2026-11-25 |
| Service and TUI language | Rust (tokio; ratatui for the TUI) | Owner, 2026-11-25 |
| GUI | C++ with a stylized Dear ImGui, on vendored UHDK (windows, OpenGL, tray) | Owner, 2026-11-25 |
| GUI look | Pixel art: a bitmap font, square bevelled widgets, hard shadows; terse, functional copy | Owner, 2026-11-25 |
| GUI layout | A file explorer with FILES, GRAPH (revision DAG) and TREE (branch > revision > changes) tabs | Owner, 2026-11-25 |
| SYNC and SUBMIT | SYNC pulls remote changes and keeps local edits; SUBMIT asks for a message, then stages, commits and pushes | Owner, 2026-11-25 |
| What SUBMIT sends | The files checked in CHANGES, all checked by default; unchecked files stay local | Owner, 2026-11-25 |
| Autosync and overlapping edits | Warn and refuse: never overwrite local edits to files the remote also changed | Owner, 2026-11-26 |
| File locking | A core feature of the desktop client: the GUI lets the user lock and unlock files, and shows who holds locks | Owner, 2026-11-26 |
| Locks after SUBMIT | SUBMIT releases your locks on the files it pushed; KEEP LOCKS beside SUBMIT holds them | Owner, 2026-11-26 |
| Editing a file someone else locked | CHANGES marks it LOCKED BY <name> and unchecks it, SUBMIT refuses it, and the tray warns when the edit is first seen | Owner, 2026-11-26 |
| Where locking lives | LOCK/UNLOCK in FILES and CHANGES, a LOCKS tab, and a per-workspace lock-on-first-edit option for binary files only | Owner, 2026-11-26 |
| Milestone 3 order | Locking, autosync and notifications built together | Owner, 2026-11-26 |
| liblore bindings | Generated by bindgen in dynamic-loading mode (`lore-sys`), checked in; the service loads liblore at run time | Implementation choice |
| Location | `desktop/` in this repository, with its own Cargo workspace and `zig build` | Owner, 2026-11-25 |
| First milestone | GUI and tray shell, talking to a stub service | Owner, 2026-11-25 |
| Frontend protocol | JSON-RPC 2.0, one message per line, over a per-user local socket | Implementation choice |
| What autosync does | Pulls only; SUBMIT is the one way to push. `on_change` pulls when someone pushes, with the interval as a fallback; the interval defaults to 5 minutes | Implementation choice, open to change |
| Which files are binary | A NUL byte in the first 8 KB, overridden by per-workspace `binary`/`text` extension lists | Implementation choice, open to change |
## Why a service
- Policies run with no window open. Autosync, lock reminders and notification watching belong
to something that outlives the GUI. The tray app then only reflects and steers it.
- One owner per working copy. The GUI and the TUI never run Lore operations themselves, so
two frontends cannot race on the same repository.
- Separate toolchains. The service links liblore, built with MSVC on Windows; the GUI links
UHDK, which targets `x86_64-windows-gnu`. As separate processes they never share a link.
Lore has its own `lore service`, verified in `docs/tutorials/run-commands-through-the-service.md`
at `6b12f00`:
- It is a per-user process that carries out CLI commands over a local socket.
- It has no policies or frontend protocol.
Our service is a liblore client like the CLI, so Lore's service settings apply to it too.
## Components
| Component | Language | Built by | Contents |
| --- | --- | --- | --- |
| `forge-service` | Rust | Cargo (`desktop/Cargo.toml`) | Local socket server, workspaces, policies, liblore calls |
| `forge-protocol` | Rust | Cargo | Message types, socket location; the protocol's reference |
| `forge-tui` | Rust | Cargo | ratatui frontend. Not started |
| `forge-desktop` | C++17 | `zig build` (`desktop/build.zig`) | UHDK window and tray, Dear ImGui UI, protocol client |
`zig build` in `desktop/` also runs Cargo for the service and installs both programs side by
side in `desktop/zig-out/bin/`, so the GUI can start the service it was built with.
## Frontend protocol
- **Transport:** a local socket private to the user.
- **macOS:** `~/Library/Application Support/lore-forge/service.sock`.
- **Linux:** `$XDG_RUNTIME_DIR/lore-forge/service.sock`, falling back to
`~/.local/state/lore-forge/service.sock`.
- **Windows:** the named pipe `\\.\pipe\lore-forge-service-<user name>`.
- On Unix the directory is mode 700.
- **Framing:** one JSON-RPC 2.0 message per line, UTF-8, no embedded newlines.
- **Handshake:** a client's first request is `hello` with the protocol version it speaks. The
service answers with its own version and refuses versions it does not speak.
- **Events:** the service sends JSON-RPC notifications (no `id`) to every connected client
after its `hello`: workspace changes, activity progress, policy decisions.
- **Single instance:** a service that finds the socket live exits. It removes a stale socket
left by a crashed service.
- **Starting the service:** a frontend that cannot connect starts `forge-service` from its own
directory, then retries.
- **Lifetime:** quitting a frontend leaves the service running. `shutdown` stops it.
`forge-protocol` is the reference; it is at protocol version 3. Requests on one connection
run concurrently, so a long sync does not hold up the explorer's reads; answers carry the
request's `id`. Workspace ids are `w` and a hash of the path.
| Method | Result |
| --- | --- |
| `hello {protocol, client}` | `{protocol, service, pid}` |
| `status` | `{workspaces, uptime_s, liblore: {loaded: {version}} or {missing: {error}}, accounts}` |
| `refresh {workspace}` | `{}`; rescans the working copy, then a `workspaces` event |
| `sync_now {workspace}` | `{}`; `activity` events follow |
| `submit {workspace, message, paths, keep_locks}` | `{}`; stages `paths`, commits, pushes, with `activity` events, then releases your locks on `paths` unless `keep_locks`. No paths: push only. Refused with `-32006` when someone else holds a lock on one of `paths` |
| `changes {workspace}` | `{changes: [{path, action, from, staged, conflict, lock, lock_mine}]}` |
| `history {workspace, limit}` | `{branches, revisions}`, revisions newest first, children before parents |
| `revision {workspace, signature}` | `{revision, changes}` |
| `files {workspace, path}` | `{path, entries: [{name, path, dir, size, change, lock, lock_mine}]}`, directories first |
| `file_history {workspace, path}` | `{path, revisions}` |
| `login {remote}` | `{}`; `login` events follow |
| `repositories {remote}` | `{repositories: [{id, name}]}` |
| `workspace_add {path}` | The workspace, for an existing working copy |
| `workspace_clone {url, path}` | The workspace; the clone follows as `activity` events of kind `clone` |
| `workspace_remove {workspace}` | `{}`; the files stay |
| `workspace_settings {workspace, autosync?, interval_s?, lock_on_edit?}` | The workspace; saved to `desktop.toml` |
| `locks {workspace}` | `{branch, locks: [{path, owner, owner_id, mine, locked_at_ms}]}`, yours first |
| `lock {workspace, paths}` | `{locked, already}`; `-32006` when someone else holds one |
| `unlock {workspace, paths, force}` | `{released}`; without `force`, other people's locks are refused with `-32006` |
| `shutdown` | `{}`, then the service exits |
A workspace is `{id, name, path, remote, state, autosync, branch, revision, signature, changes,
ahead, behind, online, signed_in, error, interval_s, lock_on_edit, warning}`; `warning` says why
autosync is holding back. An account is `{auth_url, user_id, name, expires_ms}`.
| Event | Data |
| --- | --- |
| `activity` | `{workspace, kind (sync, submit, clone), phase, progress, message, transfer}`. `transfer` is `{direction (up, down), bytes_done, bytes_total, rate, elapsed_ms}` once liblore has counted bytes: `rate` is bytes per second over the last 3 s while running, and the average on `finished`. Running events come at most every 250 ms, or when the file count changes |
| `workspaces` | The `status` workspaces list, after any change |
| `login` | `{remote, phase (waiting, done, failed), url, code, message}` |
| `locks` | `{workspace}`: someone locked or unlocked something; read `locks` and `files` again |
| `notice` | `{workspace, message}`: something the user should know, such as a lock taken on a file they edited |
Error codes beyond JSON-RPC's: `-32000` hello first, `-32001` unsupported protocol, `-32002`
no such workspace, `-32003` busy, `-32004` no liblore, `-32005` Lore refused (its message
says why), `-32006` locked by someone else (the message names the files and holders).
The service keeps its workspaces in `desktop.toml` in its config directory and rewrites it when
one is added, removed or changes settings. Per workspace it holds `autosync`, `interval_s`,
`lock_on_edit`, and the `binary` and `text` extension lists.
## liblore
Verified against the v0.14.0 release and `lore-capi/lore.h` at `6b12f00`:
- Each release publishes `liblore-<version>-<target>` for `aarch64-apple-darwin`,
`x86_64-unknown-linux-gnu`, `aarch64-unknown-linux-gnu` (tar.gz) and
`x86_64-pc-windows-msvc` (zip).
- The API has about 180 operations, all `_async`, covering auth, repositories, branches,
revisions, files, locks, links, notifications, storage and Lore's own service.
- Each operation takes `lore_global_args_t`, its own arguments and a
`lore_event_callback_config_t`. Progress and results arrive as events, ending with an END
event, on Lore's worker threads.
- Structures must be zeroed before use. Strings in events are valid only during the callback.
Verified in milestone 2 by calling v0.14.0's liblore (`lore-sys/examples/probe.rs` and
`scripts/e2e-lore.sh`):
- **Distribution:** `liblore-v0.14.0-<target>.tar.gz` holds the library and a 13,576-line
`lore.h` with about 154 operations. `lore_version()` gives `0.14.0+<build>`.
- **Bindings:** bindgen output from `lore.h` is enough; no hand-written ABI. `lore-sys/gen`
regenerates `lore-sys/src/bindings.rs`.
- **`lore_shutdown` must be called.** Without it, writes such as staging are lost when the
process exits. The service also calls `repository_flush` after each write.
- **`working_directory`** in the global arguments must be the working copy, or relative paths
(such as `file_history`'s) resolve against the process's directory.
- **History:** `revision_history` gives first-parent entries only. Each is followed by
metadata events: `message`, `created-by` (a user id), `timestamp` (ms) and `branch`.
`history` walks up to 12 branches and merges them newest first.
- **Branches:** `branch_list` reports each branch twice, local and remote.
- **Status:** with a scan, one event per changed file. An edit is action Keep with the dirty
flag; an untracked file is Add.
- **Names and remotes:** `auth_user_info` turns user ids into names; `repository_config_get`
with `remote_url` gives a working copy's remote; `repository_list` lists a server's
repositories through lore-forge's registry.
- **Sign-in:** `auth_login_interactive` with no browser emits the device URL and code, then
completes once the user approves it on the forge's device page. `auth_list` shows the
logins, each with its `oidc+http://` issuer.
- **Logins are shared with the CLI** through `LORE_AUTH_PATH`. The store's key is in the
keychain unless `LORE_AUTH_STORE=fallback` puts it in a file beside the store. A program
linking liblore reads those two variables only, not `lore`'s config.
- **Sync** keeps local edits to files the remote did not change. With overlapping edits it
fails with code 44 ("Local modifications prevent synchronization"); the service says
"local edits to files changed on the remote; submit or revert them first".
- **Commit** with nothing staged fails with code 40.
- **Blame** exists as `lore_file_audit`; nothing uses it yet.
The service finds liblore through `LORE_FORGE_LIBLORE`, else beside its own executable, where
`zig build` installs it (fetched by `scripts/fetch-lore.sh --liblore-to`). Without it the service
still runs, and `status` says why liblore is missing.
## UHDK
Vendored from `~/git/uhdk-internal` (the owner's library, MIT) into `desktop/vendor/uhdk/`; its
`VENDOR.md` records the revision and checksums. Verified in its README and headers:
- Zig 0.17.1 with a C99 API. It provides windows, input and IME, clipboard, menus, tray
icons and an OpenGL context.
- `uhdk_open`, then a `uhdk_next_frame` / `uhdk_end_frame` loop on the main thread.
`uhdk_wake` is the one call that is safe from other threads, which is how the protocol
thread wakes the UI.
- The tray works on macOS (`NSStatusItem`), Windows (`Shell_NotifyIconW`) and Linux
(StatusNotifierItem plus D-BusMenu). It needs a StatusNotifier host on Linux, and reports
`UHDK_CAP_TRAY` false without one.
- **Linux is Wayland only.** X11 is unsupported.
- **Windows builds target `x86_64-windows-gnu`.**
- Dear ImGui runs on UHDK through the UHDK example backend, which `desktop/gui/` carries a
copy of. It supports one native window, docking inside it and asynchronous clipboard
reads; no OS multi-viewports.
## Look
The owner asked for a "crunchier", pixel-art look with little copy. `gui/src/theme.*` holds it:
- **Font:** IBM VGA 8x16 from VileR's Oldschool PC Font Pack, at its native 16 px (32 px for the
title), compiled in with `#embed`. It is CC BY-SA 4.0, which asks for attribution;
`forge-desktop --licenses` prints it.
- **Palette:** Sweetie 16, by GrafxKid. Orange is the accent and primary buttons.
- **Shapes:** no rounding or anti-aliasing. Buttons are bevelled blocks with a 2 px hard shadow
that press in when held; cards have a 3 px shadow; progress is a row of cells.
- **Icons:** one 16x16 anvil, scaled by whole numbers: a black template for the macOS menu bar,
outlined in colour elsewhere, and on a tile for the app icon.
- **Copy:** labels are short and uppercase (ONLINE, SYNC, STOP SERVICE); status lines are
short and lowercase (fetching, no service at ...). No sentences where a word does.
## Explorer
Everything shown comes from the service. The GUI asks for what it draws (`model::Repo` per
workspace) and drops it when the workspace moves: a new revision, other local changes, a sync
or submit finishing.
- **Sidebar:** workspaces with their sync state and change count, ADD, FORGET, then the
branches.
- **ADD:** shown on first run, with nothing to configure beforehand. It asks which server
first: the address as typed (`lore.example.com`, `host:port`, the forge's `https://` address
or a `lore(s)://` remote) becomes `lores://host:41337`, or `lore://` for a loopback host.
CONNECT signs in unless a sign-in for that host is kept, then lists the repositories. The
server is kept in `server` beside `desktop.toml`, and the panel then shows it with CHANGE,
SIGN IN (AGAIN) and LIST. Below: open an existing working copy (CHOOSE FOLDER), or a
repository from the list, INTO a folder, CLONE.
- **Sign-in:** a banner with the device code, OPEN (the forge's device page, also opened
automatically) and COPY CODE.
- **Workspace bar:** branch, revision, AHEAD, BEHIND or OFFLINE, LOCK ON EDIT, SIGN IN when
signed out, progress, AUTO and SYNC. AUTO shows the autosync mode (OFF, 5M, ON CHANGE) and
opens a popup with the mode, the interval in minutes, and LOCK BINARY FILES ON FIRST EDIT.
Autosync's warning shows under the bar. While a sync, submit or clone moves bytes, a line
under the bar shows the direction, speed, bytes done of the total and the time left; once
it ends, the bar keeps the last transfer's size, time and average speed. A sync counts the
bytes of the files it writes, so files liblore restores from its local cache count too.
- **Notices** from the service show as dismissable lines under the header, and the newest one
and any autosync warnings go in the tray tooltip. UHDK has no OS notifications.
- **FILES:** breadcrumbs with UP and REFRESH, LOCK and UNLOCK for the chosen files (ctrl- or
shift-click chooses several), a folder tree, and a list with size and state (NEW, MOD, DEL,
MOVE for working-copy changes, LOCK for locks: blue when yours). Below, the selected file's
holder and lock time, and its revisions.
- **GRAPH:** revisions newest first with lanes. Each lane holds the revision it leads to; a
revision takes the first lane leading to it, and a parent already waited for is joined
rather than given a new lane. Lines take the branch's colour, merges are hollow nodes, and
branch heads carry a tag. Below, the selected revision's parents and changes. The web GRAPH
uses the same layout, ported to Rust in `crates/forge-web/src/pages/graph.rs`.
- **TREE:** branches, each opening to its revisions, each opening to its changes.
- **CHANGES:** local changes with a checkbox each (ALL, NONE, RESCAN, LOCK for the chosen
unlocked files), a MESSAGE, SUBMIT and KEEP LOCKS; PUSH when nothing is changed but the
workspace is ahead. A file someone else locked shows LOCKED BY <name> and cannot be checked.
- **LOCKS:** every lock on the current branch, yours first, with REFRESH, UNLOCK for yours and
FORCE UNLOCK for other people's. FORCE UNLOCK is offered to everyone; the server refuses
anyone without `admin`.
- A change or history row jumps to the file or the revision.
## Locks
The owner counts locking among the desktop client's main features: for binary assets that
cannot be merged, a user takes the file's lock before editing it.
Verified by calling v0.14.0's liblore against a real `loreserver` and lore-forge, with two
users who both hold `write` (`lore-sys/examples/probe.rs`), 2026-11-26:
- **Locks are advisory. Lore does not enforce them on push.** bob pushed a change to a file
alice had locked, and it was accepted. Only clients that check locks stop such a push, so the
desktop client checks before every submit.
- **Pushing does not release a lock.** Releasing is a separate call.
- `lore_lock_file_acquire {paths, branch}` takes a branch name, a branch id, or nothing (the
current branch). Acquiring again reports the path as already ours. Taking a lock someone else
holds fails with "resource already locked". A path that does not exist fails with code 83
("Node not found"). An untracked file and a directory can both be locked; a directory's lock
covers only that path, not what is in it.
- `lore_lock_file_release` with no owner releases the caller's own lock, reporting `not_found`
when there was none. Releasing another user's lock needs their user id as `owner_id`. A writer
is refused ("resource locked by somebody else"). The repository's owner may do it.
- Locks report their holder as a user id; the service turns ids into names.
- `lore_notification_subscribe` runs until `lore_notification_unsubscribe` is called from
another thread of the same process; then it ends at once. Meanwhile it reports locks,
unlocks, pushes (with the pusher's id and the new revision) and branches created or deleted.
An unlock notification names who released the lock, not who held it. Re-acquiring a lock you
already hold also sends a lock notification, with no paths and a zero branch.
- **One subscription per repository per process.** A second `notification_subscribe` for the
same repository replaces the first, and unsubscribing ends both. The service therefore keeps
one subscription per repository and hands its events to every workspace of that repository.
- **Names.** liblore names the signed-in user by username (`preferred_username`, "alice") and
other users by display name from UserService ("Bob Example"). The service shows what liblore
returns, so your own name and others' differ in kind.
Per [namespaces-and-access.md](namespaces-and-access.md), read in Lore's lock service and
authorizer: `write` takes locks, and `admin` also releases other people's.
As built, following the owner's choices of 2026-11-26 (the GUI side is under
[Explorer](#explorer)):
- **Enforcement is the service's.** SUBMIT, and `lock`/`unlock` without `force`, are refused with
`-32006` when someone else holds a lock on a file in them. Clients that do not check, such as
the `lore` CLI, can still push over a lock; stopping that needs enforcement in Lore itself.
- **SUBMIT** collects your locks on the files it pushes before pushing, then releases them,
unless KEEP LOCKS is ticked. Its message ends with what it released.
- **Editing a file someone else holds.** After each scan the service checks newly edited files
against the locks and sends a `notice` once per file ("d.txt is locked by Bob Example; your
edits stay local until the lock is released"). When someone locks a file you have already
edited, the notice says so.
- **Lock on first edit:** a per-workspace option, for modified binary files only. When a scan
finds one edited and unlocked, the service takes the lock.
- **Which files are binary.** Lore has no file-type notion in `lore.h`, so the service decides:
a NUL byte in the first 8 KB means binary (as git does), and the per-workspace `binary` and
`text` extension lists override that.
- **Watching.** Per workspace the service watches the working copy's files (ignoring `.lore`
and `.urc*`), rescans after 800 ms of quiet, and then runs the checks above. Notifications
keep the lock list current; a lock or unlock sends the `locks` event.
## Autosync
- **Modes:** `off`; `interval`, a sync every `interval_s` (default 300, at least 10); and
`on_change`, a sync as soon as a push notification arrives for the workspace's branch, with the
interval as a fallback. Autosync only pulls; SUBMIT is the one way to push.
- **Behind comes from notifications.** A status scan does not learn of remote pushes
(`remote_ahead` stays stale, verified with v0.14.0), so BEHIND is set when a BranchPushed
notification names a head the workspace has not reached, and cleared once it has.
- **Overlapping edits.** Before syncing, the service diffs the workspace's revision against the
remote head (`revision_diff`) and intersects that with the local changes. Any overlap holds
the sync back and sets the workspace's `warning` ("autosync held back: local edits to a.txt
overlap remote changes; submit or revert them"), which also goes out as a `notice`. Lore's own
refusal (code 44) is handled the same way, in case the check misses something. The edits are
never touched; the warning clears after the next successful sync.
- Autosync skips workspaces that are busy, offline or signed out.
## Verified so far
On macOS (Apple silicon), 2026-11-25:
- `zig build test` passes. It runs:
- the Rust tests (protocol, config, `lore-sys`, and the service's protocol handling and
liblore mapping over in-memory streams);
- `forge-desktop --test`, which starts a private service in a fresh temporary directory,
completes `hello` and `status`, draws, and stops that service.
- `scripts/e2e-lore.sh` runs `forge-service`, linked to v0.14.0's liblore, against a real
`loreserver` and lore-forge, driven by `scripts/desktop-e2e.py` as the GUI would: sign-in
through the forge's device flow, the repository list, a clone, files, history with a branch
and a merge, a revision's changes, a file's history, a submit of two of three local changes,
and a sync of the CLI's working copy that keeps its own untracked file.
- With that clone (`--config-from`, `LORE_AUTH_PATH` set to the e2e's store), the GUI
self-test syncs it, waits for the tab's data, and `--screenshot --tab` captures FILES,
GRAPH, TREE and CHANGES drawn from real data. Clicking through the explorer, the ADD panel
and the sign-in banner has not been automated.
- The tray item registers: the window offers HIDE, which it does only when UHDK reports the
tray available.
On macOS, 2026-11-26, milestone 3: `scripts/e2e-lore.sh` also gives bob writer access and a
CLI working copy, then checks through the service:
- lock, re-lock reported as already held, and the LOCKS listing;
- bob's CLI lock reaching alice's service by notification, the notice for her edit, the change's
LOCKED BY fields, and submit, lock and unlock refused with `-32006`;
- FORCE UNLOCK by alice, the repository's owner;
- SUBMIT releasing alice's lock, and lock on first edit taking `art.bin` but not `e.txt`;
- `on_change` autosync pulling bob's push, and an overlapping edit holding autosync back with a
notice and a warning while alice's edit stays.
With a held run and bob holding a lock on a file alice edited, `--screenshot --tab` captured
FILES (LOCK and UNLOCK), CHANGES (LOCKED BY, the unticked row, KEEP LOCKS) and LOCKS drawn from
real data. Clicking LOCK, UNLOCK and FORCE UNLOCK, the AUTO popup, and the notice banner have
not been exercised in the GUI; the service side of each is covered by the e2e. `--test` now
goes on when its warm-up sync is refused, so such a state can be captured.
- **A sleeping display.** On macOS the window cannot open while the display sleeps, most
likely because UHDK's display link needs an active display. `--test` then fails with "open
session: Operating system error"; waking the display (`caffeinate -u`) is enough.
- **Keychain prompts.** With the default secure token store, macOS asks once per binary (and
again after each rebuild) before liblore may read the store's key. `LORE_AUTH_STORE=fallback`
avoids that; the e2e uses it.
On Linux (NixOS 25.11, x86-64), 2026-11-27, from the archives `scripts/build-desktop-dist.sh`
packs (see [Packaging](#packaging)):
- `forge-service`, linked by `zig cc` against glibc 2.39, loads the bundled `liblore.so`
(`0.14.0+2389`) and listens on its socket.
- `forge-desktop --test` did not finish a frame from the shell it was run in, with the
bundled GUI or a native debug build alike, so the window is untried on Linux. A run from a
terminal in the desktop session is the next check.
Compiled and linked only, not run:
- **GUI:** `zig build -Dtarget=x86_64-windows-gnu` (a GUI-subsystem PE) and `x86_64-linux-gnu`.
- **Service on Windows:** cross-compiled for `x86_64-pc-windows-gnu` with Cargo, linked by
`zig cc` against Zig's MinGW (UCRT) and LLVM libunwind, with Zig's `dlltool`. It imports
only system DLLs; the named-pipe code path has never run.
- **liblore on Windows:** `LORE_TARGET=x86_64-pc-windows-msvc scripts/fetch-lore.sh --liblore`
fetches and unpacks the release zip (`lore.dll`, `lore.h`). The DLL links the C runtime
statically, so it needs no Visual C++ redistributable. A MinGW-linked service loading an
MSVC-built DLL is expected to work through the C ABI, but has not been tried.
- **GUI pipe client:** the Windows code path compiles, but no Windows run has exercised it.
Found while building:
- **Unix socket path length.** A socket path must fit `sun_path`: 103 bytes on macOS, 107 on
Linux. The default locations fit. A long `LORE_FORGE_DESKTOP_DIR` does not, and both sides
then say so rather than failing vaguely.
## Packaging
`scripts/build-desktop-dist.sh` builds, on one Linux machine, an archive per platform into
`run/downloads/`, which lore-forge offers at `/download` to signed-in users (owner,
2026-11-27):
| Archive | Contents |
| --- | --- |
| `lore-forge-desktop-linux-x86_64.tar.gz` | `forge-desktop`, `forge-service`, `liblore.so` |
| `lore-forge-desktop-windows-x86_64.zip` | `forge-desktop.exe`, `forge-service.exe`, `lore.dll` |
Each also holds Lore's MIT licence and third-party notices, and a `README.txt`. Beside them,
`SHA256SUMS` and a one-line `BUILD` (commit, Lore version, date).
- The GUI is built with `zig build -Doptimize=ReleaseSafe -Dservice=false`; Windows' `.pdb`
is left out.
- The service is built with Cargo for each target, linked by `zig cc` through wrappers the
script writes: on Linux against glibc 2.39 (liblore's own floor) and the standard
`/lib64` loader rather than the build machine's, on Windows as described under
[Verified so far](#verified-so-far).
- liblore comes from the release pinned in `lore.lock`.
- The archives are not signed. macOS is not packaged yet; whether it can be built from Linux
(the GUI links Apple's frameworks) is untried.
## Milestones
1. **GUI and tray shell.** Done.
- A UHDK window with a stylized ImGui UI.
- A tray icon whose menu offers Open, Sync all and Quit. Closing the window hides it to the
tray when one is available.
- The protocol client: connects to the service, starting it when needed, and shows its
workspaces and live activity.
- A stub service in Rust that speaks the protocol.
2. **liblore in the service.** Done on macOS.
- `lore-sys` bindings and the fetch of liblore from `lore.lock`.
- Protocol v2 with the explorer's methods; the sample repository is gone.
- Real status, sync, submit of chosen files, sign-in through the forge, the repository
list, clone, and adding or forgetting workspaces from the GUI.
3. **Locking and policies.** Done on macOS.
- Locking from the GUI: see [Locks](#locks).
- Autosync (on an interval, on a push, never): see [Autosync](#autosync). When local edits
overlap remote changes it refuses, keeps the edits, and warns in the GUI and the tray.
- Notifications from `NotificationService`: new revisions and lock changes.
- Protocol v3.
4. **TUI.** ratatui over the same protocol.
5. **lore-forge integration.** Sign-in and the repository list came in milestone 2. Left:
permissions from the forge (what the user may push or lock), and links between the GUI and
the forge's pages.
## Open
- Autosync's default interval (5 minutes for now), and whether autosync should ever push.
- Server-side lock enforcement: Lore accepts pushes over locks, so only desktop clients honour
them. Enforcing them would need a hook in Lore or a check in lore-forge's authorizer.
- Whether the service should start at login (launch agent, systemd user unit, Run key), and
who installs that.
- Signing the archives, installers, and a macOS package. Unsigned archives exist; see
[Packaging](#packaging).
- Whether to adopt Epic's desktop client once it is open source. Lore's roadmap promises it
for 2027; today it is a closed binary.