agent: DeepSeek Hermes, dsh's web UI in a window, is found and wired as dsh
WuSix on Discord: magpie's Agents page didn't find the "DeepSeek Hermes"
desktop app, so its models were added in the app by hand.
DeepSeek Hermes is motongv/deepseek-hermes-desktop 1.0.0, an Electron
window around `dsh web` (not Nous Research's Hermes Agent). Read from its
real release files: the macOS zip's Info.plist (bundle id
com.deepseek.hermes.desktop, 1.0.0) and the Windows NSIS installer's
header (InstallLocation under HKCU/HKLM Software\df9f5892-ad1c-5623-a260-
30fb0acc7e55, default %LOCALAPPDATA%\Programs\DeepSeek Hermes\DeepSeek
Hermes.exe). Both bundle @deepseek-ai/dsh 0.1.0-rc.6, which boots the
`web` profile in ~/.dsh (DSH_HOME). There is no Linux build.
Before: with no dsh CLI the dsh row was 未找到 CLI with its settings
hidden, an unopened app wasn't found at all, and a pick would have made
DeepSeek Harness Desktop's profiles/desktop, which Hermes never reads.
Now:
- desktopapp: installed() also takes the Windows exe under the app folders
or the registered InstallLocation; HasApp uses it.
- dsh: DeepSeek Hermes counts as dsh's app. With it (and no Harness
Desktop) magpie writes profiles/web/cordis.patch.yml and the key in .env
only. rc.6's dsh-credentials-local reads only the flat store and refuses
to start on the version 1 .credentials.yaml magpie writes for Harness
Desktop ("the value for "version" ... must be a string"), so that store is
not written, and one magpie wrote before (nothing but its key) is
removed. A store with the user's own keys is left alone. With Harness
Desktop also installed, its profile and store are used as before.
- noticeDsh6 for an unopened Hermes, in zh, zh-TW, ja and de.
Run:
- Real rc.6 in a sandbox HOME (npm --before=2026-08-17), never the live ~/.dsh:
- `dsh -p headless` with magpie's route and the key in .env only against
a fake gateway: POST /v1/chat/completions, model deepseek/deepseek-chat,
Bearer key, answered.
- With magpie's v1 store: `dsh web` exits on the error above; without it,
it boots.
- A web profile holding only magpie's cordis.patch.yml, `dsh web
--dump-config`: rc=0, dsh added package.json, cordis.yml and
pnpm-workspace.yaml, the patch was byte-identical after, and the
composed config has the magpie route, agent-default-model and
web-search-deepseek.
- New tests TestDshHermesFound/Windows/Wired. On the old code (0815c9186)
all three are red: "never opened: detected false", "under Programs not
found", "the web profile magpie made". The opened-with-no-CLI step alone
is red too ("opened: detected true, CLI missing true").
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- GUI: i18n-keys, agent-notice-lang, gui-de, gui-ja, gui-zh-tw: 34/34.
- Full suite: set -o pipefail; go test -tags nogui -timeout 45m ./... at
this commit on origin/main a77b5b4fc: 69 packages ok (internal/agent
420s, internal/gateway 567s, internal/gui 159s), no FAIL.
Not tried:
- The real app itself (neither the .app nor the .exe was run); detection
is from the release files' bytes.
- With both Hermes and Harness Desktop installed, Harness's v1 store still
stops Hermes's rc.6 from starting; magpie keeps the store Harness needs.
A user's own v1 store does the same, which isn't magpie's to change.
- The Windows run on the Windows box.
This commit is contained in:
@@ -283,6 +283,12 @@ func (a *Agent) AppVersion() string {
|
||||
if !ok || a.WSL != "" {
|
||||
return ""
|
||||
}
|
||||
return app.version()
|
||||
}
|
||||
|
||||
// version is the version of app installed here, "" when it isn't or doesn't
|
||||
// say (see AppVersion).
|
||||
func (app desktopApp) version() string {
|
||||
for _, bundle := range macBundles(app) {
|
||||
b, err := os.ReadFile(filepath.Join(bundle, "Contents", "Info.plist"))
|
||||
if err != nil {
|
||||
@@ -358,11 +364,16 @@ func storeAppVersion(packages []string, name, publisher string) string {
|
||||
// bundle on macOS (AppVersion), its executable on Windows: under
|
||||
// %LOCALAPPDATA%\Programs, or in the folder its installer registered.
|
||||
func (a *Agent) HasApp() bool {
|
||||
if a.AppVersion() != "" {
|
||||
app, ok := desktopApps[a.ID]
|
||||
return ok && a.WSL == "" && app.installed()
|
||||
}
|
||||
|
||||
// installed reports whether app is installed on this machine (see HasApp).
|
||||
func (app desktopApp) installed() bool {
|
||||
if app.version() != "" {
|
||||
return true
|
||||
}
|
||||
app, ok := desktopApps[a.ID]
|
||||
if !ok || a.WSL != "" || app.win == "" {
|
||||
if app.win == "" {
|
||||
return false
|
||||
}
|
||||
for _, dir := range appFolders() {
|
||||
|
||||
+123
-41
@@ -92,13 +92,26 @@ func dshAt(at place) *Agent {
|
||||
if dir == "" {
|
||||
dir = filepath.Join(at.home, ".dsh")
|
||||
}
|
||||
// DeepSeek Harness Desktop, on this machine (a distro has none)
|
||||
desktop := func() bool { return at.spell == nil && (&Agent{ID: "dsh"}).HasApp() }
|
||||
// DeepSeek Harness Desktop and DeepSeek Hermes, on this machine (a
|
||||
// distro has neither)
|
||||
harness := func() bool { return at.spell == nil && (&Agent{ID: "dsh"}).HasApp() }
|
||||
hermes := func() bool { return at.spell == nil && dshHermes.installed() }
|
||||
desktop := func() bool { return harness() || hermes() }
|
||||
// the profile an app installed and never opened starts on
|
||||
appFile := func() string {
|
||||
if harness() {
|
||||
return dshDesktopFile(dir)
|
||||
}
|
||||
return dshWebFile(dir)
|
||||
}
|
||||
// dsh's own key store is written unless DeepSeek Hermes is the app
|
||||
// here: its dsh can't start on the store's layout (dshHermes)
|
||||
store := func() bool { return !hermes() || harness() }
|
||||
path := filepath.Join(dir, "config.yaml")
|
||||
if files := dshProfiles(dir); len(files) > 0 {
|
||||
path = files[0]
|
||||
} else if desktop() {
|
||||
path = dshDesktopFile(dir)
|
||||
path = appFile()
|
||||
}
|
||||
return &Agent{
|
||||
ID: "dsh", Name: "DeepSeek Harness", Icon: "deepseek-color", Aliases: []string{"deepseek-harness"}, Spelled: prefixed,
|
||||
@@ -106,18 +119,22 @@ func dshAt(at place) *Agent {
|
||||
Bin: "dsh", Dir: dir, Path: path,
|
||||
// the desktop app installed and not opened yet has no ~/.dsh (#2279)
|
||||
sign: desktop,
|
||||
Sync: func() error { return dshSync(dir, gw()) },
|
||||
Sync: func() error { return dshSync(dir, gw(), store()) },
|
||||
Notice: func() string {
|
||||
var notes []string
|
||||
if desktop() && dshUnopened(dir) {
|
||||
if desktop() && dshUnopened(appFile()) {
|
||||
// nothing of dsh's runs on it yet to be restarted
|
||||
notes = append(notes, noticeDsh5.String())
|
||||
if harness() {
|
||||
notes = append(notes, noticeDsh5.String())
|
||||
} else {
|
||||
notes = append(notes, noticeDsh6.String())
|
||||
}
|
||||
} else if len(dshProfiles(dir)) > 0 {
|
||||
// a session dsh already has keeps the model it was on,
|
||||
// running or not: agent-default-model is read for new
|
||||
// ones only (#2359)
|
||||
notes = append(notes, noticeDsh1.String())
|
||||
} else if Running(`DeepSeek Harness\.app/`, `(^|/)dsh( |$)`) {
|
||||
} else if Running(`DeepSeek Harness\.app/`, `DeepSeek Hermes\.app/`, `(^|/)dsh( |$)`) {
|
||||
notes = append(notes, noticeDsh2.String())
|
||||
}
|
||||
if dshSearchesHere(dir) && !gateway.CanSearch() {
|
||||
@@ -129,7 +146,7 @@ func dshAt(at place) *Agent {
|
||||
}
|
||||
return strings.Join(notes, " ")
|
||||
},
|
||||
Check: func() string { return dshCheck(dir, gw()) },
|
||||
Check: func() string { return dshCheck(dir, gw(), store()) },
|
||||
// a model of DeepSeek's own picked in dsh (saved in its settings)
|
||||
// leaves magpie's route in its list: dsh is still connected, its
|
||||
// /model has magpie's models beside DeepSeek's (Fate on Discord:
|
||||
@@ -161,7 +178,7 @@ func dshAt(at place) *Agent {
|
||||
if err := dshMirrorHome(dir, nil, gw(), true); err != nil {
|
||||
return err
|
||||
}
|
||||
return dshEnv(dir, gw(), false, false)
|
||||
return dshEnv(dir, gw(), false, false, store())
|
||||
},
|
||||
// what magpie made for a desktop app never opened goes (#2279)
|
||||
Restore: func() error { return dshTidyUnopened(dir) },
|
||||
@@ -172,11 +189,11 @@ func dshAt(at place) *Agent {
|
||||
// the desktop app not opened yet: its profile is made as
|
||||
// it makes it, and it keeps the patch list it finds (#2279)
|
||||
if v != "" && len(dshProfiles(dir)) == 0 && desktop() {
|
||||
if err := dshMakeDesktop(dir); err != nil {
|
||||
if err := dshMakeProfile(appFile()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return dshSet(dir, v, gw())
|
||||
return dshSet(dir, v, gw(), store())
|
||||
},
|
||||
Options: func(map[string]string) []Option {
|
||||
own := append([]Option{}, dshModels...)
|
||||
@@ -239,16 +256,65 @@ func dshDesktopFile(dir string) string {
|
||||
return filepath.Join(dir, "profiles", "desktop", "cordis.patch.yml")
|
||||
}
|
||||
|
||||
// dshMakeDesktop makes the desktop app's patch list, as dsh's template,
|
||||
// for an app installed and never opened (#2279, liangjinyuan-sihan): with
|
||||
// no profile at all magpie had nowhere to write, and DeepSeek Harness
|
||||
// Desktop has no ~/.dsh until its first start. The app's initProfile
|
||||
// writes each of a profile's files only where it is missing ("Existing
|
||||
// files are never touched"), so on its first start it adds its
|
||||
// package.json and pnpm-workspace.yaml beside this one and keeps
|
||||
// magpie's entries. The folder is owner-only, as the app makes it.
|
||||
func dshMakeDesktop(dir string) error {
|
||||
f := dshDesktopFile(dir)
|
||||
// dshWebFile is the web profile's patch list, the one `dsh web` boots and
|
||||
// so DeepSeek Hermes (dshHermes).
|
||||
func dshWebFile(dir string) string {
|
||||
return filepath.Join(dir, "profiles", "web", "cordis.patch.yml")
|
||||
}
|
||||
|
||||
// dshHermes is DeepSeek Hermes (github.com/motongv/deepseek-hermes-desktop,
|
||||
// 1.0.0), a community desktop app that is DeepSeek Harness's web UI in a
|
||||
// window, not Nous Research's Hermes Agent (WuSix on Discord: magpie's
|
||||
// Agents page didn't find it). It starts `dsh web` from the dsh 0.1.0-rc.6
|
||||
// it bundles (resources/runtime/dsh; `npx @deepseek-ai/dsh web` without
|
||||
// it), on $DSH_HOME or ~/.dsh, so it reads the web profile's patch list as
|
||||
// the CLI does and loads ~/.dsh/.env, where magpie's key is. That dsh reads
|
||||
// only the pre-release flat layout of its key store: on the version 1
|
||||
// store magpie makes for DeepSeek Harness Desktop (#969) it fails to start
|
||||
// ("the value for "version" … must be a string"), so with this app the
|
||||
// key goes in .env alone. electron-builder makes it a per-user NSIS
|
||||
// install whose folder can be changed, under HKCU\Software\<guid>, the
|
||||
// guid a UUID v5 of its appId as dsh's is (1bf39983-… for com.deepseek.dsh
|
||||
// checks out the same way). It has no Linux build.
|
||||
var dshHermes = desktopApp{id: "com.deepseek.hermes.desktop", names: []string{"DeepSeek Hermes.app"}, win: filepath.Join("DeepSeek Hermes", "DeepSeek Hermes.exe"), guid: "df9f5892-ad1c-5623-a260-30fb0acc7e55"}
|
||||
|
||||
// dshDropOwnStore takes out dsh's key store where it holds nothing but
|
||||
// magpie's key, as magpie made it: the dsh DeepSeek Hermes runs can't start
|
||||
// on it, and .env has the key. A store holding anything of the user's
|
||||
// stays.
|
||||
func dshDropOwnStore(dir string) error {
|
||||
creds := filepath.Join(dir, ".credentials.yaml")
|
||||
raw, err := os.ReadFile(creds)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
var doc map[string]any
|
||||
if yaml.Unmarshal(raw, &doc) != nil || len(doc) != 2 || doc["version"] != 1 {
|
||||
return nil
|
||||
}
|
||||
refs, ok := doc["refs"].(map[string]any)
|
||||
if !ok || len(refs) == 0 {
|
||||
return nil
|
||||
}
|
||||
for k, v := range refs {
|
||||
s, ok := v.(string)
|
||||
if !ok || (k != dshKeyRef && k != dshOldKeyRef) || !ourKey(s) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return os.Remove(creds)
|
||||
}
|
||||
|
||||
// dshMakeProfile makes the patch list f of an app's profile, as dsh's
|
||||
// template, for an app installed and never opened (#2279,
|
||||
// liangjinyuan-sihan): with no profile at all magpie had nowhere to write,
|
||||
// and DeepSeek Harness Desktop has no ~/.dsh until its first start, nor
|
||||
// has DeepSeek Hermes. dsh's initProfile writes each of a profile's files
|
||||
// only where it is missing ("Existing files are never touched"), so on its
|
||||
// first start the app adds its package.json and pnpm-workspace.yaml beside
|
||||
// this one and keeps magpie's entries. The folder is owner-only, as the
|
||||
// app makes it.
|
||||
func dshMakeProfile(f string) error {
|
||||
if err := os.MkdirAll(filepath.Dir(f), 0o700); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -258,11 +324,10 @@ func dshMakeDesktop(dir string) error {
|
||||
return os.WriteFile(f, []byte(dshProfileTemplate), 0o644)
|
||||
}
|
||||
|
||||
// dshUnopened says the desktop app's profile is one magpie made and the
|
||||
// app hasn't started on yet: it has no package.json, which the app's first
|
||||
// start writes.
|
||||
func dshUnopened(dir string) bool {
|
||||
f := dshDesktopFile(dir)
|
||||
// dshUnopened says the app's profile with patch list f is one magpie made
|
||||
// and the app hasn't started on yet: it has no package.json, which the
|
||||
// app's first start writes.
|
||||
func dshUnopened(f string) bool {
|
||||
if !isFile(f) {
|
||||
return false
|
||||
}
|
||||
@@ -270,13 +335,22 @@ func dshUnopened(dir string) bool {
|
||||
return errors.Is(err, os.ErrNotExist)
|
||||
}
|
||||
|
||||
// dshTidyUnopened takes out, on Disconnect, what magpie made for a desktop
|
||||
// app never opened since: the profile's patch list back to dsh's template
|
||||
// dshTidyUnopened takes out, on Disconnect, what magpie made for an app
|
||||
// never opened since (DeepSeek Harness Desktop's profile or DeepSeek
|
||||
// Hermes'): the profile's patch list back to dsh's template
|
||||
// with nothing beside it, and the folders that leaves empty. A patch list
|
||||
// holding anything else, or a profile the app has started on, stays.
|
||||
func dshTidyUnopened(dir string) error {
|
||||
f := dshDesktopFile(dir)
|
||||
if !dshUnopened(dir) {
|
||||
for _, f := range []string{dshDesktopFile(dir), dshWebFile(dir)} {
|
||||
if err := dshTidyProfile(dir, f); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func dshTidyProfile(dir, f string) error {
|
||||
if !dshUnopened(f) {
|
||||
return nil
|
||||
}
|
||||
b, err := os.ReadFile(f)
|
||||
@@ -757,8 +831,9 @@ func dshGetLegacy(path string) string {
|
||||
// the gateway: magpie's route (its llm-deepseek entry before 0.1.5) pointed
|
||||
// elsewhere, the model it starts on one the route doesn't list, or — since
|
||||
// 0.1.5 — the key it names gone from .env, or another key under that name in
|
||||
// dsh's own store, which it reads first.
|
||||
func dshCheck(dir, gw string) string {
|
||||
// dsh's own store, which it reads first; with store false (dshHermes) only
|
||||
// a key there that isn't magpie's is said.
|
||||
func dshCheck(dir, gw string, store bool) string {
|
||||
if !usesMagpie(dshGet(dir)) {
|
||||
return ""
|
||||
}
|
||||
@@ -888,7 +963,7 @@ func dshCheck(dir, gw string) string {
|
||||
return "DeepSeek Harness's own key store (" + creds + ") holds another " + dshKeyRef + ", which it uses over magpie's; remove it there (dsh's Models page, Magpie's key) to go through magpie"
|
||||
}
|
||||
return "DeepSeek Harness's own key store (" + creds + ") holds another " + dshKeyRef + ", which it uses over magpie's and this magpie refuses; Apply again puts magpie's key there (Disconnect puts this one back)"
|
||||
} else if !ok && dshCredsOurs(creds) {
|
||||
} else if !ok && store && dshCredsOurs(creds) {
|
||||
// the desktop app doesn't read .env (#969)
|
||||
return "DeepSeek Harness's own key store (" + creds + ") doesn't hold " + dshKeyRef + ": the desktop app reads the key from there, not from .env, and its sessions fail with no credential for provider route " + dshRoute + " until it is written (Apply again)"
|
||||
}
|
||||
@@ -936,7 +1011,8 @@ var dshWrites sync.Mutex
|
||||
// dshSet writes v as the model new sessions start on: a catalog model
|
||||
// through the gateway, one of dsh's own models directly, or "" for dsh's own
|
||||
// default. Every profile gets it; config.yaml only where there are none.
|
||||
func dshSet(dir, v, gw string) error {
|
||||
// store says dsh's own key store is written too (dshEnv).
|
||||
func dshSet(dir, v, gw string, store bool) error {
|
||||
dshWrites.Lock()
|
||||
defer dshWrites.Unlock()
|
||||
ref, viaGateway := strings.CutPrefix(v, magpieID+"/")
|
||||
@@ -963,7 +1039,7 @@ func dshSet(dir, v, gw string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := dshEnv(dir, gw, viaGateway, true); err != nil {
|
||||
if err := dshEnv(dir, gw, viaGateway, true, store); err != nil {
|
||||
return err
|
||||
}
|
||||
// a model picked in dsh 0.1.x is saved in its settings and goes over
|
||||
@@ -1006,9 +1082,14 @@ func dshKeepPick(f string) error {
|
||||
|
||||
// dshEnv puts the key for the gateway in $DSH_HOME/.env and dsh's own key
|
||||
// store, or with on false takes it out; the name magpie's llm-deepseek entry
|
||||
// used goes either way.
|
||||
func dshEnv(dir, gw string, on, take bool) error {
|
||||
if err := dshCreds(dir, gw, on, take); err != nil {
|
||||
// used goes either way. With store false the key goes in .env alone, and a
|
||||
// key store holding nothing but magpie's key goes (dshHermes).
|
||||
func dshEnv(dir, gw string, on, take, store bool) error {
|
||||
if on && !store {
|
||||
if err := dshDropOwnStore(dir); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if err := dshCreds(dir, gw, on, take); err != nil {
|
||||
return err
|
||||
}
|
||||
env := filepath.Join(dir, ".env")
|
||||
@@ -1684,8 +1765,8 @@ func dshRouteLines(model string) []string {
|
||||
// dshSync puts the catalog as it is now into magpie's route (its
|
||||
// llm-deepseek entry before 0.1.5), in every patch list that has it; a
|
||||
// profile still on dsh's DeepSeek row taken over moves to the route.
|
||||
// Nothing else in the patch lists changes.
|
||||
func dshSync(dir, gw string) error {
|
||||
// Nothing else in the patch lists changes. store is as dshSet's.
|
||||
func dshSync(dir, gw string, store bool) error {
|
||||
dshWrites.Lock()
|
||||
defer dshWrites.Unlock()
|
||||
models := magpieModels("dsh")
|
||||
@@ -1696,7 +1777,7 @@ func dshSync(dir, gw string) error {
|
||||
defer func() {
|
||||
// the key under the name the route gives it, moved from the old one
|
||||
if _, items, err := dshRead(files[0]); err == nil && dshWired(items) {
|
||||
dshEnv(dir, gw, true, false)
|
||||
dshEnv(dir, gw, true, false, store)
|
||||
}
|
||||
}()
|
||||
for _, f := range files {
|
||||
@@ -2315,6 +2396,7 @@ var (
|
||||
noticeDsh3 = newNotice("dsh's web search goes through magpie, which has nothing to search with yet: set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Web search.")
|
||||
noticeDsh4 = newNotice("~/.dsh/settings.yaml sets its own DeepSeek endpoint or key, which dsh puts over magpie's; clear it in dsh's Models page to go through magpie.")
|
||||
noticeDsh5 = newNotice("DeepSeek Harness Desktop hasn't been opened yet: it starts on this the first time it opens.")
|
||||
noticeDsh6 = newNotice("DeepSeek Hermes hasn't been opened yet: it starts on this the first time it opens.")
|
||||
)
|
||||
|
||||
// dshDocStart says whether l is YAML's document start marker, "---" at the
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/edit"
|
||||
"github.com/yetone/magpie/internal/gateway"
|
||||
)
|
||||
|
||||
// dshHermesPlist is DeepSeek Hermes' Info.plist as its 1.0.0 macOS build
|
||||
// ships it (DeepSeek.Hermes-1.0.0-arm64-mac.zip on
|
||||
// github.com/motongv/deepseek-hermes-desktop's releases), cut to the keys
|
||||
// around the ones read, in their order and indentation.
|
||||
const dshHermesPlist = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>DeepSeek Hermes</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>DeepSeek Hermes</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.deepseek.hermes.desktop</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>DeepSeek Hermes</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0.0</string>
|
||||
</dict>
|
||||
</plist>`
|
||||
|
||||
// dshHermesHome is a home with no dsh CLI and no app, apps the folder an
|
||||
// app is installed into.
|
||||
func dshHermesHome(t *testing.T) (home, dir, apps string) {
|
||||
t.Helper()
|
||||
home, dir, _ = dshRouteHome(t)
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Setenv("PATH", t.TempDir()) // no dsh CLI
|
||||
apps = t.TempDir()
|
||||
was, wasReg := appFolders, windowsRegisteredApp
|
||||
appFolders = func() []string { return []string{apps} }
|
||||
windowsRegisteredApp = func(string) (string, string) { return "", "" }
|
||||
t.Cleanup(func() { appFolders, windowsRegisteredApp = was, wasReg })
|
||||
return home, dir, apps
|
||||
}
|
||||
|
||||
// WuSix on Discord: magpie's Agents page didn't find DeepSeek Hermes, so
|
||||
// its models were added in the app by hand. DeepSeek Hermes is DeepSeek
|
||||
// Harness's web UI in a window (dsh 0.1.0-rc.6 bundled, ~/.dsh), so it is
|
||||
// the dsh row: found installed and never opened, and opened with no dsh
|
||||
// CLI it is no leftover ~/.dsh (it was 未找到 CLI, its settings hidden).
|
||||
func TestDshHermesFound(t *testing.T) {
|
||||
judgeFor(t, "darwin")
|
||||
home, dir, apps := dshHermesHome(t)
|
||||
if dsh(home).Detected() {
|
||||
t.Fatal("neither app nor CLI, yet detected")
|
||||
}
|
||||
installApp(t, apps, "DeepSeek Hermes.app", dshHermesPlist)
|
||||
a := dsh(home)
|
||||
a.Bin = "magpie-test-gone-dsh"
|
||||
if !a.Detected() || a.CLIMissing() {
|
||||
t.Fatalf("DeepSeek Hermes never opened: detected %v, CLI missing %v", a.Detected(), a.CLIMissing())
|
||||
}
|
||||
// its profile is web's: it runs `dsh web`
|
||||
if web := filepath.Join(dir, "profiles", "web", "cordis.patch.yml"); a.Path != web {
|
||||
t.Fatalf("names %s, not the web profile", a.Path)
|
||||
}
|
||||
|
||||
// opened: dsh's initProfile made the web profile
|
||||
web := filepath.Join(dir, "profiles", "web")
|
||||
writeT(t, filepath.Join(web, "cordis.patch.yml"), dshDesktopPatch)
|
||||
writeT(t, filepath.Join(web, "package.json"), "{}\n")
|
||||
a = dsh(home)
|
||||
a.Bin = "magpie-test-gone-dsh"
|
||||
if !a.Detected() || a.CLIMissing() {
|
||||
t.Fatalf("DeepSeek Hermes opened: detected %v, CLI missing %v", a.Detected(), a.CLIMissing())
|
||||
}
|
||||
|
||||
// another app under that name is not it
|
||||
os.RemoveAll(filepath.Join(apps, "DeepSeek Hermes.app"))
|
||||
installApp(t, apps, "DeepSeek Hermes.app", strings.Replace(dshHermesPlist, "com.deepseek.hermes.desktop", "com.example.other", 1))
|
||||
if !a.CLIMissing() {
|
||||
t.Fatal("another bundle id taken for DeepSeek Hermes")
|
||||
}
|
||||
}
|
||||
|
||||
// On Windows DeepSeek Hermes' installer (electron-builder's NSIS, read from
|
||||
// DeepSeek.Hermes.Setup.1.0.0.exe) puts DeepSeek Hermes.exe under
|
||||
// %LOCALAPPDATA%\Programs\DeepSeek Hermes, or a folder the user picks,
|
||||
// registered under HKCU\Software\df9f5892-…'s InstallLocation.
|
||||
func TestDshHermesWindows(t *testing.T) {
|
||||
home, _, apps := dshHermesHome(t)
|
||||
picked := t.TempDir()
|
||||
reg := map[string][2]string{}
|
||||
windowsRegisteredApp = func(guid string) (string, string) { r := reg[guid]; return r[0], r[1] }
|
||||
if dsh(home).Detected() {
|
||||
t.Fatal("nothing installed, yet detected")
|
||||
}
|
||||
writeT(t, filepath.Join(apps, "DeepSeek Hermes", "DeepSeek Hermes.exe"), "MZ")
|
||||
if !dsh(home).Detected() {
|
||||
t.Fatal("DeepSeek Hermes under Programs not found")
|
||||
}
|
||||
os.RemoveAll(filepath.Join(apps, "DeepSeek Hermes"))
|
||||
reg["df9f5892-ad1c-5623-a260-30fb0acc7e55"] = [2]string{picked, "1.0.0"}
|
||||
if dsh(home).Detected() {
|
||||
t.Fatal("a registered folder without the app taken for it")
|
||||
}
|
||||
writeT(t, filepath.Join(picked, "DeepSeek Hermes.exe"), "MZ")
|
||||
if !dsh(home).Detected() {
|
||||
t.Fatal("DeepSeek Hermes in its registered folder not found")
|
||||
}
|
||||
}
|
||||
|
||||
// Picking a model of magpie's with DeepSeek Hermes installed and never
|
||||
// opened writes the web profile it will start on, and the key in .env
|
||||
// alone: the dsh it bundles (0.1.0-rc.6) refuses to start on the version 1
|
||||
// key store magpie makes for DeepSeek Harness Desktop ("the value for
|
||||
// "version" … must be a string"), and reads .env. A store magpie made
|
||||
// before goes; one with the user's keys stays.
|
||||
func TestDshHermesWired(t *testing.T) {
|
||||
home, dir, apps := dshHermesHome(t)
|
||||
installApp(t, apps, "DeepSeek Hermes.app", dshHermesPlist)
|
||||
web := filepath.Join(dir, "profiles", "web", "cordis.patch.yml")
|
||||
creds := filepath.Join(dir, ".credentials.yaml")
|
||||
read := func(p string) string { b, _ := os.ReadFile(p); return string(b) }
|
||||
|
||||
a := dsh(home)
|
||||
if err := a.Pick("model", "magpie/deepseek/flash"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := read(web)
|
||||
if !strings.HasPrefix(s, strings.TrimSuffix(dshDesktopPatch, "[]\n")) || !strings.Contains(s, "apiKeyEnv: "+dshKeyRef) || !strings.Contains(s, "provider: "+dshRoute) {
|
||||
t.Fatalf("the web profile magpie made:\n%s", s)
|
||||
}
|
||||
if isFile(dshDesktopFile(dir)) {
|
||||
t.Fatal("made DeepSeek Harness Desktop's profile, which DeepSeek Hermes doesn't read")
|
||||
}
|
||||
if isFile(creds) {
|
||||
t.Fatalf("wrote dsh's key store, which DeepSeek Hermes' dsh can't start on:\n%s", read(creds))
|
||||
}
|
||||
if v, _ := edit.GetEnvFile(filepath.Join(dir, ".env"), dshKeyRef); v != keyAt(gateway.URL()) {
|
||||
t.Fatal("no key in .env")
|
||||
}
|
||||
a = dsh(home)
|
||||
if !a.Wired() || a.Check() != "" {
|
||||
t.Fatalf("not wired: wired %v, check %q", a.Wired(), a.Check())
|
||||
}
|
||||
if n := a.Notice(); !strings.Contains(n, noticeDsh6.String()) || strings.Contains(n, "Harness Desktop") {
|
||||
t.Fatalf("notice: %q", n)
|
||||
}
|
||||
|
||||
// a store magpie made before, with nothing but its key: it goes
|
||||
writeT(t, creds, "version: 1\nrefs:\n "+dshKeyRef+": "+keyAt(gateway.URL())+"\n")
|
||||
if err := a.Pick("model", "magpie/deepseek/pro"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if isFile(creds) {
|
||||
t.Fatalf("magpie's own key store outlived a pick:\n%s", read(creds))
|
||||
}
|
||||
// the user's own keys there stay
|
||||
own := "version: 1\nrefs:\n MINE_API_KEY: sk-mine\n " + dshKeyRef + ": " + keyAt(gateway.URL()) + "\n"
|
||||
writeT(t, creds, own)
|
||||
if err := a.Pick("model", "magpie/deepseek/flash"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if read(creds) != own {
|
||||
t.Fatalf("the user's key store changed:\n%s", read(creds))
|
||||
}
|
||||
os.Remove(creds)
|
||||
|
||||
// Disconnect before the app ever opened: what magpie made goes
|
||||
if err := a.Disconnect(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(dir, "profiles")); !os.IsNotExist(err) {
|
||||
t.Fatalf("the profile magpie made outlived Disconnect: %v\n%s", err, read(web))
|
||||
}
|
||||
|
||||
// with DeepSeek Harness Desktop here too, its profile and store as before
|
||||
installApp(t, apps, "DeepSeek Harness.app", dshAppPlist)
|
||||
a = dsh(home)
|
||||
if err := a.Pick("model", "magpie/deepseek/flash"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !isFile(dshDesktopFile(dir)) || !strings.Contains(read(creds), dshKeyRef+": ") {
|
||||
t.Fatalf("DeepSeek Harness Desktop's profile %v, store:\n%s", isFile(dshDesktopFile(dir)), read(creds))
|
||||
}
|
||||
if n := a.Notice(); !strings.Contains(n, noticeDsh5.String()) {
|
||||
t.Fatalf("notice with both apps: %q", n)
|
||||
}
|
||||
}
|
||||
@@ -387,7 +387,7 @@ func TestDshRouteAgainLeavesTheRouteWithNoCatalog(t *testing.T) {
|
||||
if b, _ := os.ReadFile(web); string(b) != stale {
|
||||
t.Fatalf("a route written with no catalog:\n%s", b)
|
||||
}
|
||||
if err := dshSync(filepath.Join(home, ".dsh"), gateway.URL()); err != nil {
|
||||
if err := dshSync(filepath.Join(home, ".dsh"), gateway.URL(), true); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if b, _ := os.ReadFile(web); string(b) != stale {
|
||||
@@ -450,7 +450,7 @@ func TestDshFillNewProfilesLeavesABareProfileWithNoCatalog(t *testing.T) {
|
||||
"- id: agent-default-model\n config:\n provider: magpie\n model: deepseek/pro\n"), 0o644)
|
||||
bare := "# A new profile.\n[]\n"
|
||||
os.WriteFile(desktop, []byte(bare), 0o644)
|
||||
if err := dshSync(dir, gateway.URL()); err != nil {
|
||||
if err := dshSync(dir, gateway.URL(), true); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if b, _ := os.ReadFile(desktop); string(b) != bare {
|
||||
@@ -467,7 +467,7 @@ func TestDshFillNewProfilesFillsABareProfile(t *testing.T) {
|
||||
dshRouteFixture("deepseek/pro", "deepseek/flash")+
|
||||
"- id: agent-default-model\n config:\n provider: magpie\n model: deepseek/flash\n"), 0o644)
|
||||
os.WriteFile(desktop, []byte("# A new profile.\n[]\n"), 0o644)
|
||||
if err := dshSync(dir, gateway.URL()); err != nil {
|
||||
if err := dshSync(dir, gateway.URL(), true); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, _ := os.ReadFile(desktop)
|
||||
|
||||
@@ -3720,6 +3720,7 @@ const I18N = {
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code 启动时读取设置,需重启已打开的 muse 会话才会生效。",
|
||||
"New dsh sessions start on this. A session made before keeps its model, open now or reopened later, until you pick another in it with /model or the model button by its message box. A dsh started with -p or in a terminal reads it at start-up.": "新的 dsh 会话会使用这项设置。之前建的会话,无论现在开着还是以后再打开,都保留原来的模型,直到你在其中用 /model 或输入框旁的模型按钮另选一个。用 -p 或在终端里启动的 dsh 在启动时读取它。",
|
||||
"DeepSeek Harness Desktop hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Harness 桌面版还没打开过:第一次打开时就会使用这项设置。",
|
||||
"DeepSeek Hermes hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Hermes 还没打开过:第一次打开时就会使用这项设置。",
|
||||
"OpenChamber takes the new model for new sessions; sessions already open keep theirs.": "OpenChamber 的新会话会使用新模型;已打开的会话保留原来的模型。",
|
||||
"OpenChamber's project {project} has a default model of its own ({model}), which it uses there instead.": "OpenChamber 的项目 {project} 有自己的默认模型({model}),在该项目里会改用它。",
|
||||
"OpenPencil reads its settings when it starts and writes them all back when it quits — quit OpenPencil before changing this, then open it and pick a magpie model in its chat's model picker.": "OpenPencil 启动时读取设置、退出时把设置全部写回 —— 请先退出 OpenPencil 再更改这里,然后打开它,在聊天的模型选择器中选一个 magpie 的模型。",
|
||||
@@ -7602,6 +7603,7 @@ const I18N = {
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code 啟動時讀取設定,需重啟已打開的 muse 會話才會生效。",
|
||||
"New dsh sessions start on this. A session made before keeps its model, open now or reopened later, until you pick another in it with /model or the model button by its message box. A dsh started with -p or in a terminal reads it at start-up.": "新的 dsh 會話會使用這項設定。之前建立的會話,無論現在開著還是以後再打開,都保留原來的模型,直到你在其中用 /model 或輸入框旁的模型按鈕另選一個。用 -p 或在終端裡啟動的 dsh 在啟動時讀取它。",
|
||||
"DeepSeek Harness Desktop hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Harness 桌面版還沒開啟過:第一次開啟時就會使用這項設定。",
|
||||
"DeepSeek Hermes hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Hermes 還沒開啟過:第一次開啟時就會使用這項設定。",
|
||||
"OpenChamber takes the new model for new sessions; sessions already open keep theirs.": "OpenChamber 的新會話會使用新模型;已打開的會話保留原來的模型。",
|
||||
"OpenChamber's project {project} has a default model of its own ({model}), which it uses there instead.": "OpenChamber 的專案 {project} 有自己的預設模型({model}),在該專案裡會改用它。",
|
||||
"OpenPencil reads its settings when it starts and writes them all back when it quits — quit OpenPencil before changing this, then open it and pick a magpie model in its chat's model picker.": "OpenPencil 啟動時讀取設定、結束時把設定全部寫回 —— 請先結束 OpenPencil 再變更這裡,然後開啟它,在聊天的模型選擇器中選一個 magpie 的模型。",
|
||||
@@ -11486,6 +11488,7 @@ const I18N = {
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code は起動時に設定を読み込みます。反映するには開いている muse セッションを再起動してください。",
|
||||
"New dsh sessions start on this. A session made before keeps its model, open now or reopened later, until you pick another in it with /model or the model button by its message box. A dsh started with -p or in a terminal reads it at start-up.": "新しい dsh セッションはこれで始まります。以前に作ったセッションは、今開いていても後で開き直しても、その中で /model か入力欄の横のモデルボタンで別のモデルを選ぶまで今のモデルのままです。-p 付きやターミナルで起動した dsh は起動時に読み込みます。",
|
||||
"DeepSeek Harness Desktop hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Harness デスクトップ版はまだ一度も開かれていません。初めて開いたときからこの設定で始まります。",
|
||||
"DeepSeek Hermes hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Hermes はまだ一度も開かれていません。初めて開いたときからこの設定で始まります。",
|
||||
"OpenChamber takes the new model for new sessions; sessions already open keep theirs.": "OpenChamber は新しいセッションで新しいモデルを使います。開いているセッションは今のモデルのままです。",
|
||||
"OpenChamber's project {project} has a default model of its own ({model}), which it uses there instead.": "OpenChamber のプロジェクト {project} には独自のデフォルトモデル({model})があり、そこではそちらが使われます。",
|
||||
"OpenPencil reads its settings when it starts and writes them all back when it quits — quit OpenPencil before changing this, then open it and pick a magpie model in its chat's model picker.": "OpenPencil は起動時に設定を読み込み、終了時に設定をすべて書き戻します。ここを変更する前に OpenPencil を終了し、その後開いてチャットのモデル選択で magpie のモデルを選んでください。",
|
||||
@@ -15370,6 +15373,7 @@ const I18N = {
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code liest seine Einstellungen beim Start – offene muse-Sitzungen neu starten, damit es gilt.",
|
||||
"New dsh sessions start on this. A session made before keeps its model, open now or reopened later, until you pick another in it with /model or the model button by its message box. A dsh started with -p or in a terminal reads it at start-up.": "Neue dsh-Sitzungen starten damit. Eine vorher angelegte Sitzung behält ihr Modell, ob jetzt offen oder später wieder geöffnet, bis Sie darin mit /model oder der Modell-Schaltfläche neben dem Eingabefeld ein anderes wählen. Ein mit -p oder im Terminal gestartetes dsh liest es beim Start.",
|
||||
"DeepSeek Harness Desktop hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Harness Desktop wurde noch nie geöffnet: Beim ersten Öffnen startet es mit dieser Einstellung.",
|
||||
"DeepSeek Hermes hasn't been opened yet: it starts on this the first time it opens.": "DeepSeek Hermes wurde noch nie geöffnet: Beim ersten Öffnen startet es mit dieser Einstellung.",
|
||||
"OpenChamber takes the new model for new sessions; sessions already open keep theirs.": "OpenChamber nimmt das neue Modell für neue Sitzungen; bereits offene behalten ihres.",
|
||||
"OpenChamber's project {project} has a default model of its own ({model}), which it uses there instead.": "Das OpenChamber-Projekt {project} hat ein eigenes Standardmodell ({model}), das dort stattdessen genutzt wird.",
|
||||
"OpenPencil reads its settings when it starts and writes them all back when it quits — quit OpenPencil before changing this, then open it and pick a magpie model in its chat's model picker.": "OpenPencil liest seine Einstellungen beim Start und schreibt sie beim Beenden alle zurück – OpenPencil vor dieser Änderung beenden, dann öffnen und in der Modellauswahl seines Chats ein magpie-Modell wählen.",
|
||||
@@ -15591,6 +15595,7 @@ const NOTICES = [
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.",
|
||||
"New dsh sessions start on this. A session made before keeps its model, open now or reopened later, until you pick another in it with /model or the model button by its message box. A dsh started with -p or in a terminal reads it at start-up.",
|
||||
"DeepSeek Harness Desktop hasn't been opened yet: it starts on this the first time it opens.",
|
||||
"DeepSeek Hermes hasn't been opened yet: it starts on this the first time it opens.",
|
||||
"OpenChamber takes the new model for new sessions; sessions already open keep theirs.",
|
||||
"OpenChamber's project {project} has a default model of its own ({model}), which it uses there instead.",
|
||||
"OpenPencil reads its settings when it starts and writes them all back when it quits — quit OpenPencil before changing this, then open it and pick a magpie model in its chat's model picker.",
|
||||
|
||||
Reference in New Issue
Block a user