On top of #2279's commit (041e99063), which reads the folder DeepSeek
Harness Desktop's installer registers under HKCU\Software\<guid>.
cjyrainbow installed it to D:\tools\dsh; magpie 0.1.1248 showed
"未找到 CLI" with no switch. Since d0fcb8bcd (#2177) an agent whose folder
(~/.dsh) has no CLI and no app magpie can find is shown as gone, so a
desktop app outside %LOCALAPPDATA%\Programs, listed before by its ~/.dsh
alone, lost its row's settings ("it used to be recognised").
electron-builder's installer writes Software\<guid> InstallLocation and
an Uninstall\<guid> entry under HKCU for a per-user install and under HKLM
for an all-users one. #2279 read HKCU only. registeredIn now reads both
hives (64-bit view, then 32-bit), and when InstallLocation is missing the
Uninstall entry's InstallLocation, else the folder of its DisplayIcon
("…\DeepSeek Harness.exe,0") or UninstallString. The exe must still be in
that folder (registered(), from #2279).
Test: TestDshDesktopRegisteredAnyHive (per user, all users, the Uninstall
entry's folder, icon and uninstaller; an icon that is no exe finds nothing).
Run in this worktree:
- gofmt -l internal/agent: clean
- go vet -tags nogui ./internal/agent/ (darwin), GOOS=linux -tags nogui,
GOOS=windows: clean
- go test: NOT run. The disk had 300-750 MB free (the session rule is
1 GB before any go test), so the new test and the package were not run
and nothing was broken by hand yet. Run before landing:
go test -tags nogui -p 1 -run 'TestDshDesktop' ./internal/agent/
Not tried: no real Windows install; the registry reader was not run on
the Windows box. The reporter's hive (HKCU or HKLM) is not known.
Full suite: SUITE_LINE
DeepSeek Harness Desktop already reads magpie's route: its lib/main.js
(0.2.0-rc.2, the latest on its update feed, read from download.deepseek.com's
dmg and Windows installer) resolves $DSH_HOME, else ~/.dsh, and runs on
profiles/desktop, so the CLI's wiring applies. Three gaps remained:
- Installed but never opened, there is no ~/.dsh: the row wasn't listed,
and connecting wrote the legacy config.yaml the app never reads. magpie
now writes profiles/desktop/cordis.patch.yml from dsh's own template
(PROFILE_PATCH_TEMPLATE) with its routes; the app's initProfile writes
only missing files, so its first start keeps them. The notice says it
starts on this when first opened (noticeDsh5, in all 5 languages).
Disconnect before that first start removes what magpie made, when
nothing else is there; afterwards only magpie's entries go.
- On Windows the installer lets the user pick the folder and registers it
under HKCU\Software\1bf39983-50d0-5fe0-9ef4-cece76f67c5e InstallLocation
(read from the NSIS script of dsh-latest-windows-x64.exe). magpie reads
that, so a custom folder is found, and the Uninstall entry's
DisplayVersion gives the version shown.
Tests: TestDshDesktopNeverOpened (pick on a never-opened app writes the
desktop profile, a user's key in .credentials.yaml and the user's own start
survive Disconnect, the app's first start is told apart),
TestDshDesktopRegisteredFolder (registry stubbed; exe must be there; WSL
twin has none).
Run on this tree, rebased onto 707fbb249:
- gofmt -l: clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui
- go test -tags nogui ./internal/agent/: ok (846s, loaded box)
- GUI, Chromium and WebKit: agent-notice-lang, gui-de, gui-ja,
gui-zh-tw, agent-app-version, agent-cli-missing: 79 pass
Full suite: SUITE_LINE
Not tried: the real app was not run (Electron's userData isn't fully
redirected by a sandbox HOME); it was inspected statically (dmg mounted
read-only, app.asar extracted, NSIS header decoded). The registry reader
was not run on a real Windows install; the test stubs the registry.
On Windows the Codex app is the Store package OpenAI.Codex
(C:\Program Files\WindowsApps\OpenAI.Codex_26.1002.7124.0_x64__2p2nqsd0c76g0
in the report), which magpie didn't read: only %LOCALAPPDATA%\Programs was
looked in. The version now comes from the package full names under the
current user's AppX repository key (HKCU\...\AppModel\Repository\Packages),
which needs no access to the protected WindowsApps folder and starts no
PowerShell. The newest OpenAI.Codex package with publisher id 2p2nqsd0c76g0
wins.
Test: TestCodexWindowsStoreAppVersion (picks the newest, skips a bad
version and another publisher, and a WSL twin shows none).
[Message rewritten at review to say what and why; the code is AwadYoo's. The
conflict with 2221b63f9 (macAppFolders) was resolved by keeping both.]