diff --git a/internal/agent/dsh.go b/internal/agent/dsh.go index 7436f7485..bc2cad88e 100644 --- a/internal/agent/dsh.go +++ b/internal/agent/dsh.go @@ -75,10 +75,16 @@ const ( // dshModels are the models dsh reaches on its own, as it ships them — under // its own name, not DeepSeek: magpie's DeepSeek provider is a group of that // name too, and two would read as one listed twice (#115). +// +// They are @deepseek-ai/dsh-llm-deepseek's DEFAULT_MODELS, ids and names as +// dsh has them: deepseek-flash and deepseek-v4-pro since 0.1.6, with +// deepseek-flash named "DeepSeek-V4.1-Flash" since 0.2.1 ("DeepSeek-V41- +// Flash" from 0.1.5 to 0.2.0). deepseek-v4-flash was dsh's up to 0.1.5 only; +// a dsh of today answers it "Select an available model" (Kylin_Cloud on X). +// A profile that still names it keeps it: magpie doesn't rewrite it. var dshModels = []Option{ - {Value: "deepseek-flash", Label: "DeepSeek-V41-Flash", Icon: "deepseek-color", Group: "DeepSeek Harness"}, + {Value: "deepseek-flash", Label: "DeepSeek-V4.1-Flash", Icon: "deepseek-color", Group: "DeepSeek Harness"}, {Value: "deepseek-v4-pro", Label: "DeepSeek-V4-Pro", Icon: "deepseek-color", Group: "DeepSeek Harness"}, - {Value: "deepseek-v4-flash", Label: "DeepSeek-V4-Flash", Icon: "deepseek-color", Group: "DeepSeek Harness"}, } func dsh(home string) *Agent { return dshAt(here(home)) } diff --git a/internal/agent/dsh_test.go b/internal/agent/dsh_test.go index 0913cf7be..0ba0e1911 100644 --- a/internal/agent/dsh_test.go +++ b/internal/agent/dsh_test.go @@ -368,3 +368,53 @@ func TestDshToldTheWindowSetForACustomProvider(t *testing.T) { } } } + +// dsh's own models are the ones dsh ships, named as dsh names them +// (@deepseek-ai/dsh-llm-deepseek's DEFAULT_MODELS, 0.2.1 on): +// deepseek-flash is DeepSeek-V4.1-Flash, and deepseek-v4-flash, gone from +// dsh since 0.1.6, isn't offered (Kylin_Cloud on X). A profile that still +// starts on it is read as it is and not rewritten. +func TestDshOwnModelsAreDshs(t *testing.T) { + home := dshTempHome(t) + saveDeepseek(t) + dir := filepath.Join(home, ".dsh") + web := filepath.Join(dir, "profiles", "web", "cordis.patch.yml") + os.MkdirAll(filepath.Dir(web), 0o755) + os.WriteFile(web, []byte("# Your patch layer for this dsh profile.\n[]\n"), 0o644) + settings := filepath.Join(dir, "settings.yaml") + saved := "agent-default-model:\n provider: deepseek-official\n model: deepseek-v4-flash\n" + os.WriteFile(settings, []byte(saved), 0o644) + + want := map[string]string{"deepseek-flash": "DeepSeek-V4.1-Flash", "deepseek-v4-pro": "DeepSeek-V4-Pro"} + own := func(name string, opts []Option) { + t.Helper() + got := map[string]string{} + for _, o := range opts { + if !strings.HasPrefix(o.Value, magpieID+"/") { + got[o.Value] = o.Label + } + } + if len(got) != len(want) { + t.Fatalf("%s: dsh's own models %v, want %v", name, got, want) + } + for v, l := range want { + if got[v] != l { + t.Fatalf("%s: %s is %q, want %q (all: %v)", name, v, got[v], l, got) + } + } + } + + f := dsh(home).Field("model") + own("dsh", f.Options(nil)) + if f.Get() != "deepseek-v4-flash" { + t.Fatalf("the saved start: %q", f.Get()) + } + if b, _ := os.ReadFile(settings); string(b) != saved { + t.Fatalf("the saved start was rewritten:\n%s", b) + } + + // a stopped distro's dsh lists the same + d := distro{Name: "Stopped", Root: t.TempDir(), Home: "/home/me", Gateway: "172.20.0.1"} + k := wslKindOf("dsh") + own("dsh in a stopped distro", asleep(wslAgent(k, d), k, d).Field("model").Options(nil)) +} diff --git a/internal/gui/agent_models_own_test.go b/internal/gui/agent_models_own_test.go index feb5f5f51..39c8c2fd2 100644 --- a/internal/gui/agent_models_own_test.go +++ b/internal/gui/agent_models_own_test.go @@ -64,7 +64,7 @@ func TestAgentOwnModelsHidden(t *testing.T) { } return own, magpie } - all := []string{"deepseek-flash", "deepseek-v4-pro", "deepseek-v4-flash"} + all := []string{"deepseek-flash", "deepseek-v4-pro"} if got := call("GET", ""); !got.Own || got.OwnHidden { t.Fatalf("dsh's list: %+v, want its own models there and shown", got) diff --git a/internal/gui/tests/agent-models-own.test.cjs b/internal/gui/tests/agent-models-own.test.cjs index e60d0e7aa..0daeb9adf 100644 --- a/internal/gui/tests/agent-models-own.test.cjs +++ b/internal/gui/tests/agent-models-own.test.cjs @@ -15,9 +15,9 @@ const { chromium, webkit } = require("playwright"); const assets = path.resolve(__dirname, "../assets"); -const own = ["deepseek-flash", "deepseek-v4-pro", "deepseek-v4-flash"].map((v) => ({ - value: v, label: v.replace("deepseek", "DeepSeek").replace("-v4", "-V4").replace("-flash", "-Flash").replace("-pro", "-Pro"), - icon: "deepseek-color", group: "DeepSeek Harness", direct: "DeepSeek", +// dsh's own as internal/agent's dshModels lists them +const own = [["deepseek-flash", "DeepSeek-V4.1-Flash"], ["deepseek-v4-pro", "DeepSeek-V4-Pro"]].map(([value, label]) => ({ + value, label, icon: "deepseek-color", group: "DeepSeek Harness", direct: "DeepSeek", })); const magpie = ["pro", "flash"].map((m) => ({ value: "magpie/deepseek/" + m, label: "deepseek-" + m, ref: "deepseek/" + m, note: "DeepSeek · via magpie", group: "DeepSeek", icon: "deepseek-color" })); const list = magpie.map((o, i) => ({ id: o.ref, name: o.label, group: "DeepSeek", icon: "deepseek-color", inUse: i === 0 })); @@ -156,7 +156,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await sw.getAttribute("aria-checked"), "false"); await close(); let rows = await picked(); - assert.doesNotMatch(rows, /DeepSeek-V4-Pro|DeepSeek-Flash/, "dsh's own still offered"); + assert.doesNotMatch(rows, /DeepSeek-V4-Pro|DeepSeek-V4\.1-Flash/, "dsh's own still offered"); assert.match(rows, /deepseek-flash/, "magpie's are offered"); // and so in the state read again await page.waitForTimeout(1800);