English | 中文
deepseek-harness-linux-desktop
Unofficial patch set that gives the DeepSeek Harness desktop app a Linux x64 release
target (deb) and brings its behaviour in line with the macOS build.
Upstream ships macOS and Windows only — its own apps/desktop/README.md states
"Linux is not a supported Desktop release target", and the packaging tests assert that a
linux-x64 target must be rejected. This repository is the set of diffs that opens that
path up.
Status: Linux x64 is migrated to upstream
dsh-v0.2.1-rc.2, with local typecheck, Linux package preflight, and deb build completed. The current patch directory contains one final migration diff; the previous 30 topic patches remain archived for traceability. Linux releases use the deb package, withdsh-scnet@0.6.13bundled.
Base: upstream tag dsh-v0.2.1-rc.2, represented by one final migration diff.
Table of contents
- 1. What you get
- 2. Requirements and fixed paths
- 3. Build — one-shot script
- 4. Build — step by step (with success conditions)
- 5. Acceptance checklist (the 7 behaviours)
- 6. Artifacts and where they land
- 7. Failure triage
- 8. Verified / not verified
- 9. Known limits
- 10. Layout, license, attribution
- 11. SCNet integration roadmap
1. What you get
| # | macOS behaviour | How the patch set delivers it on Linux |
|---|---|---|
| 1 | App starts | The desktop policy gate no longer throws desktop policy: unsupported platform on Linux |
| 2 | Window chrome | titleBarStyle: 'hidden' + titleBarOverlay (the same mechanism Windows uses), so the page owns the titlebar area; DSH_DESKTOP_LINUX_NATIVE_FRAME=1 restores the desktop frame |
| 3 | Closing the last window keeps tasks running | window-all-closed quits only on Windows now; the application and its Host stay alive, with a Show Window menu entry to get the window back |
| 4 | dsh command on PATH |
New POSIX launcher plus a Linux branch of the command installer (~/.local/bin/dsh); an existing foreign command is reported and backed up, never silently overwritten |
| 5 | dsh:// deep links |
Desktop entry carries MimeType=x-scheme-handler/dsh; the shell already registers the scheme |
| 6 | Bundled runtime | Runtime preparation selects the Linux payload (Node/pnpm/Python, Electron binary, native packages) by target platform instead of assuming macOS or Windows |
| 7 | Updates | Linux packages do not have an automatic update feed |
Office document conversion works out of the box: Linux uses the bundled WASM LibreOffice
engine (@deepseek-ai/libreoffice-kit-wasm), not a system LibreOffice.
2. Requirements and fixed paths
The build host must be Linux x86_64. The patch keeps upstream's rule that linux-x64
refuses to build anywhere else, so this cannot be cross-built from macOS. linux-arm64 is
not part of this series.
| Requirement | Value | Check |
|---|---|---|
| Host | Linux x86_64 | uname -sm → Linux x86_64 |
| Node | ^22.19.0 \|\| >=24.0.0 |
node -v |
| pnpm | 11.7.0 |
corepack enable && pnpm -v |
| git | any recent | git --version |
| Free disk | ≥ 15 GB (checkout ≈ 200 MB, dependencies + Electron + runtime payloads several GB) | df -h "$HOME" |
| Network | registry.npmjs.org, nodejs.org, Python standalone builds, github.com (Electron), electron-builder's own downloads |
proxy-dependent; see triage |
| Display for the smoke run | X11/Wayland, or xvfb-run |
echo "$DISPLAY$WAYLAND_DISPLAY" |
Paths used throughout this document — set them first:
export PATCH_REPO="$HOME/src/deepseek-harness-linux-desktop" # this repository
export SRC="$HOME/src/deepseek-harness" # upstream checkout (created below)
export TARGET_DIR="$SRC/apps/desktop/.desktop-build/targets/linux-x64"
export ARTIFACTS="$TARGET_DIR/artifacts"
3. Build — one-shot script
An agent can execute this block as-is (it aborts on the first failed assertion):
set -euo pipefail
# --- preflight -------------------------------------------------------------
[ "$(uname -s)" = "Linux" ] || { echo "FAIL: host is not Linux"; exit 1; }
[ "$(uname -m)" = "x86_64" ] || { echo "FAIL: host is not x86_64"; exit 1; }
command -v git >/dev/null || { echo "FAIL: git missing"; exit 1; }
command -v node >/dev/null || { echo "FAIL: node missing"; exit 1; }
corepack enable >/dev/null 2>&1 || true
[ "$(pnpm -v)" = "11.7.0" ] || echo "WARN: pnpm is $(pnpm -v), expected 11.7.0"
export PATCH_REPO="${PATCH_REPO:-$HOME/src/deepseek-harness-linux-desktop}"
export SRC="${SRC:-$HOME/src/deepseek-harness}"
# --- fetch the patch set and apply it --------------------------------------
[ -d "$PATCH_REPO/.git" ] || git clone https://github.com/lql341/deepseek-harness-linux-desktop.git "$PATCH_REPO"
sh "$PATCH_REPO/apply.sh" "$SRC"
# --- prove the patches landed ---------------------------------------------
echo "patched tree hash: $(git -C "$SRC" rev-parse HEAD^{tree})"
[ -f "$SRC/apps/desktop/.env.linux" ] || { echo "FAIL: .env.linux missing"; exit 1; }
# --- dependencies ----------------------------------------------------------
cd "$SRC"
pnpm install --frozen-lockfile
# --- cheap preflight: validates .env.linux and the build toolchain ---------
pnpm --dir apps/desktop run check:package # expect: "would publish 0.2.0-rc.2 ... valid"
# --- directory build first: does it even start? ----------------------------
pnpm --dir apps/desktop run package:linux:x64:dir
# --- real artifacts --------------------------------------------------------
pnpm --dir apps/desktop run package:linux:x64
ls -l "$SRC/apps/desktop/.desktop-build/targets/linux-x64/artifacts"
4. Build — step by step (with success conditions)
Step 0 — host preflight
uname -sm # expect: Linux x86_64
node -v # expect: v22.19+ or v24+
corepack enable && pnpm -v # expect: 11.7.0
df -h "$HOME" # expect: >= 15G available
If uname -m is aarch64, or uname -s is Darwin, stop: this patch set does not cover
that combination. On macOS you can still apply the patches (step 1 works anywhere) but
package:linux:x64 will refuse to run.
Step 1 — clone this repository and apply the series
git clone https://github.com/lql341/deepseek-harness-linux-desktop.git "$PATCH_REPO"
sh "$PATCH_REPO/apply.sh" "$SRC"
apply.sh clones upstream at tag dsh-v0.2.0-rc.2, creates branch linux-desktop, runs
git am on all 28 patches, and copies .env.linux.example to .env.linux (the packaging
code requires that file and aborts without it).
Success conditions — all four must hold:
git -C "$SRC" log --oneline | head -1
# expect: "build(desktop): update the SCNet bundle to 0.6.13"
git -C "$SRC" rev-parse HEAD^{tree}
# expect: the tree hash of this exact 26-patch series. Run apply.sh to read it; it is recorded
# by the publish workflow's release notes. A different value means a patch did not
# apply, or the series changed.
git -C "$SRC" status --porcelain # expect: empty
test -f "$SRC/apps/desktop/.env.linux" && echo env-ok
To review rather than trust: git -C "$SRC" log --stat shows one commit per patch.
Step 2 — install dependencies
cd "$SRC"
pnpm install --frozen-lockfile
Expect exit 0. Mirrors work if the default registry is slow — either set
DSH_DESKTOP_NPM_REGISTRY in apps/desktop/.env.linux (used by the bundled runtime
install), or ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ for the Electron
download.
Step 3 — cheap preflight (no build, seconds)
pnpm --dir apps/desktop run check:package
This validates .env.linux, the release settings and the host toolchain, then prints
something like desktop package: linux-x64 would publish 0.2.0-rc.2; local configuration and toolchain valid. Fix anything it reports before spending time on a real build — this is the
cheapest place to catch a wrong pnpm, a missing .env.linux, or a bad entry in it.
Step 4 — directory build (the first real build)
pnpm --dir apps/desktop run package:linux:x64:dir
Every package command builds the whole repository itself, prepares the Electron
distribution, installs the production runtime closure from the registry, and writes the
unpacked application. Expect several minutes and a lot of output; exit 0 is the pass
condition.
Success conditions:
ls -d "$ARTIFACTS"/linux-unpacked # unpacked application
ls -l "$ARTIFACTS/linux-unpacked/DeepSeek Harness" # the Electron binary, executable
Step 5 — deb
pnpm --dir apps/desktop run package:linux:x64
ls -l "$ARTIFACTS"/*.deb
DEB=$(find "$ARTIFACTS" -maxdepth 1 -name '*.deb' -print -quit)
node "$PATCH_REPO/ci/scnet-release-audit.mjs" \
--deb "$DEB" \
--package-set "$SRC/apps/desktop/.desktop-build/targets/linux-x64/package-set" \
--expected-version 0.6.13
Expect one deb artifact named from the product version (see §6).
The SCNet release audit reads the exact app.asar with the packaged Electron runtime and verifies
the fixed Bundle/Skill version, package-set integrity and MIT license, runtime descriptor hashes,
and the absence of populated credentials, private endpoints, caches, __pycache__, and .pyc.
No signing or notarization runs for Linux.
Pass --build-version if you want your own numbering, e.g.
pnpm --dir apps/desktop run package:linux:x64 -- --build-version 0.2.0-rc.2.linux.1;
without it, artifacts carry the upstream product version.
Step 6 — smoke run
# Directory build, headless host:
xvfb-run -a "$ARTIFACTS/linux-unpacked/DeepSeek Harness"
# Or install the deb (also what makes the dsh command usable, see §9):
sudo apt install "$ARTIFACTS"/deepseek-harness-*-linux-amd64.deb
dpkg -L deepseek-harness | grep -E '/(bin|opt)/' # find the installed executable
# then launch it from the desktop menu, or run the path printed above (quote it: it contains a space)
Things to watch in the first 30 seconds:
- it must reach the workspace/welcome UI and not print
desktop policy: unsupported platform; - the window should have no system titlebar and native controls at the top right
(if the desktop environment draws something odd, retry with
DSH_DESKTOP_LINUX_NATIVE_FRAME=1); - in a container without user namespaces, Chromium's sandbox may refuse to start — prefer the
deb, or add--no-sandboxonly as a last resort (it lowers security).
5. Acceptance checklist (the 7 behaviours)
Run these in order; each one maps to a patch in patches/.
| # | Check | Command / observation | Expected |
|---|---|---|---|
| 1 | Starts | launch as in step 6 | workspace opens, no unsupported platform error |
| 2 | Window chrome | look at the window; toggle DSH_DESKTOP_LINUX_NATIVE_FRAME=1 |
overlay caption + native controls; env var restores the frame |
| 3 | Stays alive | close the last window, then pgrep -af "DeepSeek Harness" |
process still running; Show Window menu item brings the window back; explicit Quit really exits |
| 4 | dsh on PATH |
install the command from the app UI, then in a new shell: command -v dsh && dsh --version |
~/.local/bin/dsh, runs the bundled CLI (ensure ~/.local/bin is on PATH) |
| 5 | Deep link | xdg-mime query default x-scheme-handler/dsh then xdg-open 'dsh://open' |
a desktop file is registered and the window focuses |
| 6 | Runtime + Office | in a session run a shell tool; ask for a DOCX→PDF conversion | bash tool works (Landlock, kernel ≥ 5.13); conversion succeeds via the bundled WASM engine |
| 7 | Updates | Linux package update policy | no update check; there is no automatic update feed |
6. Artifacts and where they land
Everything is written under apps/desktop/.desktop-build/targets/linux-x64/:
| Path | Contents |
|---|---|
artifacts/linux-unpacked/ |
unpacked application (from :dir); executable DeepSeek Harness |
artifacts/deepseek-harness-<version>-linux-amd64.deb |
Debian package |
runtime/ |
prepared Electron + pnpm + launcher for this target |
dsh/ |
the bundled dsh runtime tree that becomes app.asar/dsh |
package-set/, downloads/ |
intermediate package set and downloaded archives |
packaging-runs/ |
per-run logs and the release record |
With the default version these are
deepseek-harness-…-linux-amd64.deb.
7. Failure triage
| Symptom | Cause | Action |
|---|---|---|
desktop package: unsupported target "linux-x64" |
patches not applied | re-run step 1; verify the tree hash |
desktop package: cannot read …/.env.linux; copy … |
required env file missing | cp apps/desktop/.env.linux.example apps/desktop/.env.linux |
desktop package: linux-x64 requires a Linux x64 build host |
building on macOS/arm64 | build on Linux x86_64 |
desktop package: unsupported setting X in …/.env.linux |
key not in the Linux template | use only DSH_DESKTOP_APP_ID, DSH_DESKTOP_NPM_REGISTRY, and the policy origins |
ERR_PNPM_UNSUPPORTED_ENGINE / odd dependency errors |
wrong Node or pnpm | Node ^22.19 \|\| >=24, pnpm 11.7.0 |
| Electron download timeouts / 404 | proxy or mirror | ELECTRON_MIRROR, or export HTTPS_PROXY |
missing required LibreOffice engine wasm |
the WASM kit is absent from the runtime tree | confirm @deepseek-ai/libreoffice-kit-wasm installed (it is an optional dependency of @deepseek-ai/libreoffice-kit) |
Type errors from tsc in main.ts |
first real type check | report them; the policy-branch narrowing is the most likely spot |
| Deep link does nothing | desktop file not registered | confirm xdg-mime query default x-scheme-handler/dsh; reinstall the deb |
8. Verified / not verified
The source of truth for "is it green?" is CI, not this document. Every claim below is
produced by the Linux desktop verification workflow; read the run list and per-step logs at
https://github.com/lql341/deepseek-harness-linux-desktop/actions for the current state.
This section records what the suite covers and what it concluded, so a failure can be
triaged without re-deriving what the jobs do.
CI keeps the useful package signal and skips the headless false failure. A push to main
applies the patches, installs dependencies, typechecks, builds the Linux deb, installs
the deb, and checks startup, close behaviour and dsh:// activation. Only the plain second-launch
window assertion is skipped under Xvfb; Ubuntu and Debian real desktop sessions confirmed that
path. Longer upstream gates and checks against already-published bytes remain manual.
The workflow's jobs and what each one establishes:
| Job | Establishes | Runs on |
|---|---|---|
install + typecheck + package preflight + Linux package smoke |
patches apply, typecheck and package preflight pass, deb build, installed deb starts and handles close/dsh:// on Ubuntu 24.04 |
push |
Debian 13 and multi-distro package acceptance |
Debian 13 offline install, first launch, profile-state checks and purge; the deb is the exact artifact from the Ubuntu job | manual (run-multidistro) |
current candidate upgrade and profile migration |
the latest published deb can be replaced by the current candidate on Ubuntu; legacy launcher cleanup, untouched profile migration, explicit disable preservation and custom-profile preservation pass | manual (run-candidate-upgrade) |
upstream Linux gates, sandbox confinement, keyless agent smoke |
upstream's own Linux gate, bwrap/Landlock confinement, and a keyless agent turn | manual |
deb upgrade path and AppArmor-hardened launch |
upgrading two published debs cleans the legacy launcher, and the app starts under kernel.apparmor_restrict_unprivileged_userns=1 without --no-sandbox |
manual |
Wayland |
the deb boots as a pure Wayland client under a headless compositor | manual |
Removed, and what each cost:
Debian 13 (trixie)— a secondary distribution check. It downloads the exact deb built by
the Ubuntu job and runs only when the manualrun-multidistroinput is enabled, so a Debian
container or Docker-registry issue cannot block daily push verification.linux-gates-baseline— the gate on the unpatched base tag. An attribution tool, useful while
developing, not a gate.
Verified:
- All 28 patches apply cleanly on
dsh-v0.2.0-rc.2; aftergit amthe worktree is clean with
no leftover changes. (The tree hash moves with the series, so read it with
git -C <src> rev-parse HEAD^{tree}rather than comparing against a value quoted here.) apply.shruns end to end, including under a C locale with no git identity configured:
fresh shallow clone → 28 patches →.env.linuxcreated → exit 0.check:packagepasses and the official Linux build passes runtime preparation, Office
document round-trip, and Electron packaging.- The packaged application starts and serves its local
dsh webendpoint, with no
desktop policy: unsupported platformrejection on Ubuntu, Debian 13, or Wayland. - The deb works end to end:
apt-get installreportsStatus: install ok installed;
update-alternativespoints/usr/bin/deepseek-harnessat
/opt/DeepSeek Harness/deepseek-harness;xdg-mime query default x-scheme-handler/dsh
answersdeepseek-harness.desktop; the installed binary runs as Electron 44 / Node 24;
resources/runtime/cli/bin/dsh --versionprints0.2.0-rc.2; the packaged command manager
installs~/.local/bin/dshand it works fromPATH; removal andapt-get removeboth
leave nothing behind. (patches/0010is what makes the launcher reachable at all — before
it, every run printeddsh: the … payload is missing.) - The Linux installer uses the Debian-safe executable name
deepseek-harness; its generated
postinstregisters that name withupdate-alternativesinstead of using the display name,
and removes the legacy/usr/bin/DeepSeek Harnesssymlink during upgrades. - The bundled runtime answers from inside the archive:
ELECTRON_RUN_AS_NODE=1 <launcher> --expose-internals resources/app.asar/dsh/node_modules/@deepseek-ai/dsh-desktop-host/lib/cli.js --version
prints0.2.0-rc.2and exits 0. The payload lives insideapp.asar;asarUnpackholds
only the.node/.sobinaries, ripgrep, the libreoffice kit and the Landlock launcher, so a
shell test on that path can never succeed. - The Linux native set is complete in the unpacked tree (
node-pty,sharp-linux,
koffi-linux,ripgrep-linux,node-addon-system-linux,sherpa-onnx-linux,
libreoffice-kit-wasm) with no darwin/win32 leftovers outsideresources/runtime/pnpm. - Sandbox confinement on a real kernel: the bwrap leg and the Landlock leg each pass, and
each is asserted to have run rather than self-skipped — the Landlock files force the bwrap
rung off, so each proves exactly one mechanism. - A keyless agent turn:
apps/cli/tests/profiles/headless/tests/keyless-smoke.e2e.ts
boots the real Loader tree with no API key, runs the productionbashtool, asserts the
tool/call→tool/resultround trip (CLI_TOOL_ROUND_TRIP) and that the turn is persisted
as zstd JSONL. Together withscripts/smoke-runtime.tsthis covers PTY, FFI (koffi), sharp,
ripgrep, glob, the bundled pnpm and Python, and real DOCX/XLSX/PPTX→PDF conversion through
the bundled Office engine withPATHemptied. - Desktop suite baseline on Linux: 123 of 128 files pass (1357 tests passed, 58 skipped).
The single failing file isapps/desktop/tests/macos-notarization-proxy.spec.ts, which guards
a macOS-only feature and whoseflockhelper is not built on Linux. The two files that failed
before —cli-launcher.spec.ts(fixed bypatches/0010) anddesktop-upload-plan.spec.ts
(patches/0011) — now pass. - Upstream's own Linux gate,
pnpm run check:ci:linux-primary: 78 of 80 gates pass on the
patched tree, against 79 of 80 on the unpatched base tag under identical settings. Neither
remaining failure is ours —web browser snapshotfails the same way on the unpatched tag
(the browsers install, but the runner lacks their system libraries, which is why both install
steps pass--with-deps), and one case inscripts/persistence-schema.spec.tsis flaky in
both directions.patches/0012fixed the two gate failures that were ours: four oxlint style
errors and a commit-hash reference thatverify-repository-referencesrejects. test:coverageis tolerated as a known flake. The gate step treats the upstream primary
gate as a soft pass (emitting a::warning::) whentest:coverageis the only failing gate
task, and still fails hard on any other failure.
Not verified in this environment:
- Electron's
titleBarOverlayappearance per desktop environment; window drag/resize and
caption sizing in both themes. - Desktop integration itself (tray, notifications, window controls in a real session); the
suite covers the packaged runtime, not a running desktop.
9. Known limits
- Not achievable 1:1: macOS traffic-light buttons, sidebar
vibrancy, Dock bounce. The
patch set substitutes native overlay window controls, a flat sidebar, and notifications.
mount, so installing a command from it is refused with an actionable message
(DSH_DESKTOP_RESOURCESis the escape hatch for an extracted tree). - Platform identity: a Linux build reports the macOS desktop identity to DeepSeek
Platform, because the shared account package only definesdarwin/win32for
x-client-platform(omitting it degrades toweb). - Mandatory-update policy is inert on Linux (there is no official Linux feed).
- Only
linux-x64;linux-arm64is not part of this series. - The welcome window's caption colour follows the system palette only at creation.
- The
debmaintainer field is a placeholder (DeepSeek Harness). -
Window restore after close works on both paths. Closing the last window keeps the application and its Host running (by design). The first
dsh://activation restores the window —patches/0013fixes that activation-rebuild path.patches/0014narrows the early-return infocusPrimaryWindowso a plain second launch routed through the instance lock also restores the window. Both are asserted byci/desktop-session.sh(the dsh:// activation brought the window back,the window returned after the plain second launch) and both were confirmed on a real Xfce/X11 desktop session against the installed…linux.3deb, the relaunch path three times in a row. The headless runner in CI has never reported that second assertion green; the discrepancy is a property of the headless environment, not of the patch.CI skips only the plain-relaunch assertion under Xvfb; the release still blocks on every other
session failure. The plain-relaunch behaviour is covered by real Ubuntu/Debian desktop checks. - Two checks cannot run inside the Debian container job. Docker's default seccomp profile
deniesunshare, so the bwrap sandbox leg self-skips there (the Landlock leg runs strictly) and
the keyless agent smoke fails while reading its own session directory
(ENOENT …/.sessions) without surfacing the driver's stderr, so it is reported rather than
gated. Both run strictly on the Ubuntu runner, where the kernel allows the namespaces they need.
10. Layout, license, attribution
patches/0001..0029*.patch git format-patch series, applied in file-name order
apply.sh clone upstream at the base tag, apply the series, create .env.linux
verify.sh one-shot Linux diagnostic (--env-only / --full); emits a tarball
LINUX-DESKTOP.md long-form guide: per-file notes, verified facts, open items
LICENSE MIT (upstream DeepSeek + this patch set)
verify.sh is the diagnostic to run when a build fails on your Linux host: it records PASS/FAIL
per step and writes a dsh-verify-<stamp>.tar.gz you can attach to an issue. It never uses
sudo and writes only under verify-logs/.
Each patch is one topic: (1) accept the target, (2) install the dsh command,
(3) prepare the Linux runtime payload, (4) macOS-like shell behaviour, (5) documentation,
(6) packaging type declarations, (7) Debian-safe executable naming, (8) legacy launcher
cleanup during upgrades, (9) Linux fields in the installer config declarations, (10) let the
launcher reach the bundled dsh payload inside app.asar, (11) keep the update environment in
the upload-plan error, (12) satisfy the upstream repository gates, (13) keep a rebuilt
window on screen after an activation, (14) restore the window on a plain second launch, and
(15) refresh the SCNet status when the window regains focus.
This patch set is distributed under the MIT License (see LICENSE). The patches are diffs
against deepseek-ai/deepseek-harness,
which is MIT-licensed, Copyright (c) 2026 DeepSeek; that notice is retained here.
Not affiliated with, endorsed by, or supported by DeepSeek. Upstream is in developer preview
and iterates quickly, so expect conflicts when rebasing onto newer tags.
11. SCNet integration roadmap
The long-term plan for SCNet OAuth2, the preinstalled dsh-scnet bundle, Linux Desktop login,
Android, iOS, HarmonyOS, and enterprise Linux distributions is documented in
docs/roadmap/SCNET-PLATFORM-DEVELOPMENT-PLAN.zh-CN.md.
It separates the desktop plugin from mobile connectors and treats OAuth2 + PKCE, secure storage,
account linking, and cross-platform acceptance as release gates.