Commit Graph
18 Commits
Author SHA1 Message Date
yetone 49f207c784 agents: DS Bot, wired in the DSH home it runs on
DS Bot (github.com/Fei2411/DS-Bot, Apache-2.0, dsbot.app) is a DSH plugin
and an Electron app built on it. The app ships its own DSH (0.2.2-rc.1 in
0.3.0) and runs it with DSH_HOME at a data folder of its own, booting the
profile ds-bot, and never reads ~/.dsh: magpie's dsh row didn't reach it.

It is a row of its own now, ds-bot (dsbot.go), wired by dsh's code on its
folder (dshOn, split out of dshAt): magpie's routes and start in
profiles/ds-bot/cordis.patch.yml, the key in that folder's .env and
.credentials.yaml. The folder is $DS_BOT_HOME, else locations.json's
dataDir in the app's userData ($DS_BOT_SHELL_DATA, else <config>/DS Bot,
or the legacy DeepSeek Bot), else ~/.ds-bot, as the app's first-run.mjs and
legacy.mjs choose it. A locations.json that can't be read or names no
folder is unknown: nothing is read or written. The routes there list the
models shown for DS Bot on the Agents page (dshListFor), and the serving
round fills a profile the app makes there as it does ~/.dsh's
(dshHomesRounds). Found by DS Bot.app (io.github.fei2411.dsbot) or its
Windows per-user install (guid from its electron-builder.yml). Three
notices, translated into zh, zh-TW, ja and de. DS_BOT_HOME and
DS_BOT_SHELL_DATA are in agentenv's sandbox list.

Run:
- go test ./internal/agent/ ./internal/agentenv/ ./internal/gui/
  ./internal/cli/ ./internal/appdir/ on mote: ok but
  internal/gui TestMainWindowCorners/macOS_26_SDK, red on mote's macOS 27
  whatever the change (#3949).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./... on mote: ok. gofmt -l: clean.
- node --test i18n-keys, i18n-en-no-cjk, agent-notice-lang (chromium), and
  agent-notice-lang in webkit: all pass but i18n-keys "a plugin's words
  are its own", red on main for three plugin words (#5332, #5426, #5482).
- Real DS Bot 0.3.0 (DS-Bot-0.3.0-mac-arm64.zip) on mote, all in a sandbox
  HOME with DS_BOT_HOME, DS_BOT_SHELL_DATA and DS_BOT_WORKSPACE under it:
  a magpie built from this tree (nogui), MAGPIE_ADDR 127.0.0.1:3572, a
  fake OpenAI upstream on 3571 added as a provider. `magpie ds-bot
  magpie/fake/m1` before the app was ever opened wrote the profile; the
  app's first start kept it (agent-default-model still magpie's) and added
  its own files beside it. Its Chief Bot offered "Magpie: m1 · fake, m2 ·
  fake"; picking m1 and sending "ping" over CDP went through magpie to the
  fake (POST /v1/chat/completions model m1, stream) and "pong from fake"
  showed. `magpie ds-bot default` then took every magpie entry out and the
  .env with it. Only my own pids (app, serve, fake) were stopped.

Broken by hand, each red, then put back:
- dsbot's desktopApps entry out: TestDsBotWired (not detected).
- dshListFor always "dsh": TestDsBotOwnModels.
- dshHomesRounds without DS Bot's home: TestDsBotProfileMadeWhileServing.
- a bad locations.json taken for ~/.ds-bot: TestDsBotDataFolder.
On the old code the tests don't build (no ds-bot row at all).

Not tried: the Windows app (install path and registry guid read from its
electron-builder.yml, not from an installed copy); Linux (its AppImage and
deb aren't looked for; the data folder its first start makes finds it);
a real vendor behind magpie; a default Bot model set in DS Bot (the notice
says it wins, per its models.js). Not done: usage gives DS Bot no
User-Agent of its own (its DSH's requests likely count as dsh's), and the
Sessions page doesn't read its data folder's sessions.

Reported-by: rnhung
2026-11-07 05:43:04 +08:00
yetone be5e8f29f1 dsh: its own models are the two it ships, deepseek-flash named DeepSeek-V4.1-Flash (Kylin_Cloud on X)
Kylin_Cloud (X, 11-06, v0.1.2606): DeepSeek Harness's direct models in
magpie listed deepseek-v4-flash, which dsh doesn't have, and showed
deepseek-flash as "DeepSeek-V41-Flash"; dsh's built-ins are only
DeepSeek-V4.1-Flash and DeepSeek-V4-Pro.

Cause: dshModels is a table copied by hand from dsh 0.1.5 (4091b9dfd),
not generated from models.dev and not a label prettifier. dsh's own
table is @deepseek-ai/dsh-llm-deepseek's DEFAULT_MODELS; packed from npm:
  0.1.0-rc.8, 0.1.2-rc.1  deepseek-v4-flash, deepseek-v4-pro (+ vision-exp)
  0.1.5-rc.3              deepseek-flash "DeepSeek-V41-Flash", v4-flash, v4-pro
  0.1.6-alpha.2..0.2.0    deepseek-flash "DeepSeek-V41-Flash", deepseek-v4-pro
  0.2.1-rc.5, 0.2.2-rc.1  deepseek-flash "DeepSeek-V4.1-Flash", deepseek-v4-pro
The installed dsh here (0.2.1-rc.2) has the same two. So "V41" was dsh's
own name from 0.1.5 to 0.2.0, kept after dsh renamed it, and
deepseek-v4-flash left dsh in 0.1.6 while magpie kept offering it.
No other code makes a label from "4.1": V41 is in dsh.go alone.

Now dshModels is dsh's two, named as dsh 0.2.1 on names them. The WSL
(stopped distro) picker reads the same table.

A profile already starting on deepseek-v4-flash: magpie reads it as it is
and doesn't rewrite settings.yaml or the patch list; it is no longer
offered in the list. Since dsh 0.1.6 dsh itself refuses it
(dsh-api-session-controller requireModel: "Select an available model
before sending a message.", it checks listModels, i.e. DEFAULT_MODELS),
so that start was already broken in dsh before this change; picking
either model in magpie or in dsh fixes it.

Siblings pinning the old three: internal/gui's TestAgentOwnModelsHidden
(red under the full suite with the new table, now dsh's two) and the GUI
fixture agent-models-own.test.cjs, which also had made-up labels.

Run (mote, rebased on origin/main f47390bf3):
- TestDshOwnModelsAreDshs: red on the old table (lists deepseek-v4-flash,
  "DeepSeek-V41-Flash"), and red again with only the label fixed (still
  lists deepseek-v4-flash); green with the change.
- go test ./internal/agent: ok.
- node --test agent-models-own.test.cjs (chromium + webkit, en/zh/de/ja,
  narrow and wide): 16/16 ok. i18n-keys: "a plugin's words are its own"
  red, the same three words already filed (#5327, #5332, #5426, #5482),
  not touched by this change.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., GOOS=linux/windows go build: ok. gofmt -l: nothing.
- go test -timeout 45m ./... (shared lock): every package ok but gui and
  provider. gui: TestAgentOwnModelsHidden (fixed above), and
  TestMainWindowCorners (#3949) and TestPanelHiddenByWailsMarksPageOutOfSight
  (#5322), both filed; provider: TestRenewLoginsKeepsClaudeReading (#5481,
  filed). After the fix go test ./internal/gui: only TestMainWindowCorners
  (#3949) red.

Not tried: a real dsh session started on deepseek-v4-flash (the refusal
above is read from dsh's source); dsh before 0.1.5 (it had no
deepseek-flash; every dsh on npm since 0.1.6 has it); Windows/WSL run.

At the pushed head (rebased on b020ae102, which touches gateway, provider
and agent's Claude Desktop only): go vet ./internal/agent ./internal/gui,
go test ./internal/agent -run Dsh and ./internal/gui -run
TestAgentOwnModels: ok.
2026-11-06 16:51:15 +08:00
ggbdpq faa69b8319 dsh: a dsh test's temp home is given up only once it is really gone
TestDshSetEffortWritesALegacyEntryWithTheCatalog died once at cleanup,
not in its body: on Windows, t.TempDir's RemoveAll found .config/magpie
not empty (LoKi's box, reported by yetone, #2982). Save replaces
providers.json by renaming a file over it, and a scanner holding the
file that was just renamed over keeps its entry listed while the entry
is pending deletion, so the folder reads as not empty for a moment;
t.TempDir's own cleanup retries a sharing violation but not a
"not empty" one, so it gave up on the first try. The seven dsh tests
that set up such a home now share dshTempHome, which tries the removal
until the folder is really gone, for a short while, before t.TempDir's
cleanup gets its turn.

Not verified on Windows: the failure is one-off under a scanner there,
and on macOS removing a folder whose file is still open succeeds, so
the race cannot be reproduced on this machine. With the retry taken
out the suite is green on macOS as before, so the only change in
behavior is the retry itself.

Generated-by: GLM-5.3-Flash (ZCode)

Review: go test -tags nogui -count=20 -run TestDsh ./internal/agent/ ok on
Windows 11 (xiaomi-gpu, win-run, 232s) and -count=3 on mote. The cleanup
is registered after t.TempDir, so it runs first (LIFO) and TempDir's own
RemoveAll finds the folder gone.
Not tried: a Windows box under the load that made the original red.
2026-11-06 05:53:50 +08:00
yetone 844c355059 dsh: the model shown is the start of the profile in use, and the round's log says what it wrote (#5222)
#5222: with DeepSeek Harness Desktop and four profiles, the desktop
profile started on hy4free while web, headless and open-design started
on deepseek-v4.1-flash, and magpie's log said "wrote dsh's route again"
every half minute or so. Read against dsh 0.2.1-rc.2's own source and
reproduced in a sandbox HOME with dsh's real save (saveSelection through
ConfigEditor.edit and its yaml 2.9.1 library):

- dsh saves a model picked in it into the profile in use alone. The
  profiles drifting apart is dsh's design, and each start is the user's
  own: magpie copies it nowhere.
- magpie never wrote over that pick. After dsh's save the next round
  wrote once, moving magpie's web search entry to follow the new start,
  and then wrote nothing. The log called that "wrote dsh's route again",
  which read as magpie rewriting agent-default-model.
- magpie read the start from the web profile alone, so with the desktop
  app in use the Agents page showed a model its sessions don't start on,
  and picking what it showed changed nothing there.
- A session dsh already has keeps the model of its last request until a
  model is picked in it (selectionFor in dsh-api-session-controller), as
  noticeDsh1 says. The reporter's 429s were OpenCode Zen Free's own free
  limit, reached by a session still on it; the gateway didn't change the
  model.

Now the model and effort fields read the desktop profile when DeepSeek
Harness Desktop is installed (dshLead), else web's as before, and effort
levels are checked against that model. The round logs "dsh's web search
in <file> follows the model it starts on now" when that entry is all it
moved; "wrote dsh's route again" is kept for the route itself.

Run (mote, on origin/main 7dd2434d3; rebased onto 78128b510, which touches
no internal/agent file, and -run TestDsh ./internal/agent run again at
the pushed head: ok):
- go test -run TestDsh ./internal/agent: ok
- go test ./internal/agent, go vet ./internal/agent with GOOS linux and
  windows, gofmt -l: ok (internal/agent 230.6s)
- TestDshShowsTheStartOfTheProfileInUse uses the bytes dsh's own save
  wrote in the sandbox.

Broken by hand, each red:
- dshLead ignoring the desktop profile: "model shown =
  magpie/deepseek/pro, want the desktop profile's magpie/deepseek/flash".
- the search-only write logged as a route write: "the round's log doesn't
  say its one write was the search entry".

Not tried: the real DeepSeek Harness Desktop app with the reporter's
profiles; a user who runs dsh's web profile while the desktop app is
installed still sees the desktop profile's start. Not changed: magpie's
writers find the first agent-default-model entry while dsh writes the
last (dshFind vs findLastIndex); no profile with two was seen (#5229).
2026-11-04 19:23:49 +08:00
yetone 7aad6a50ea provider: a window set for all of a custom provider's models wins over another vendor's guess
MisakaNatsuxun (Discord, 10-23) set a custom OpenAI-compatible provider's
Advanced > Context window to 1M. Routing still showed 200K for
deepseek-v4.1-flash-free, and dsh was told contextWindow 200000.

Cause: WindowOf capped the provider-wide "*" window at ListedWindow(m)
(#2112, 273ab9c23). ListedWindow falls back to catalog.ContextOf, a guess
by model id from any vendor on models.dev. For a relay with no catalog of
its own, opencode's deepseek-v4.1-flash-free (200000) or Anthropic's
claude-sonnet-4-5 (200000) capped the user's 1M. WindowOf feeds Served,
so /v1/models, the Routing picker, the editor's model chips and every
agent config (dsh's contextWindow too) got 200K.

Fix: "*" is capped only by the provider's own word: catalog.Window
(m.Context, set from its live list, its own models.dev catalog or plan
models) and m.MaxContext. #2112's OpenCode Go case still caps, since that
catalog sets m.Context. A per-model entry already won and still does.

Siblings: Max output (replyLimit) already took the user's value over
m.Output and the catalog, on old and new (checked "*"=128000). Anthropic-
and Responses-type custom providers read the same WindowOf and are fixed
with it. Left alone: with no window set, OutputWithin still caps a
user's Max output at the guessed window.

Tests, each red on the old code (ListedWindow put back by hand):
- provider TestProviderWindowSetOverAnotherVendorsGuess: "map[*:1000000]:
  claude-sonnet-4-5 told 200000, want 1000000"
- agent TestDshToldTheWindowSetForACustomProvider (opencode's
  deepseek-v4.1-flash-free fixture, dshRouteConfig and
  dshProviderLines): told contextWindow 200000

Sandbox HOME, fake OpenAI /models on 127.0.0.1:3481, relay "*"=1M:
- old binary: /v1/models relay/deepseek-v4.1-flash-free 200000,
  relay/claude-sonnet-4-5 200000; connecting dsh wrote contextWindow
  200000; no 1M on the Sonnet chip in the editor or the Routing picker.
- new binary (this tree, -tags dev): 1000000 for both, dsh config
  written fresh says contextWindow 1000000 / maxTokens 32000 (ca4a1cde0's
  cap at the model's output); Routing picker "DeepSeek V4.1 Flash Free
  1M"; relay-a (anthropic), relay-r (responses) 1M; relay-lo "*"=128K
  stays 128000.

Not tried: a real relay account, and dsh making a real request.

Run at 62cf0c76d (this tree on origin/main 032d88c13): gofmt -l clean;
go vet darwin, linux -tags nogui, windows clean; go test -tags nogui
-timeout 45m ./... : 69 ok, 19 no test files, no FAIL (agent 336s,
gateway 474s, gui 123s, provider 187s). GUI files in chromium and
webkit: context-picks 10/10, provider-advanced-fold 25/25,
provider-output-picks 2/2, compact-at 4/4, gui-ja 3/3, gui-zh-tw 3/3,
gui-de 3/3, i18n-keys 3/3.
2026-10-23 02:17:01 +08:00
yetone ca4a1cde0d dsh: maxTokens leaves dsh half its window, or a quarter for output where that is more (#3298 item 3)
822f2b304 (#2823) held the maxTokens magpie lists for dsh to a quarter
of the window, because dsh reserves it, plus 65536 of headroom, before
it compacts (compaction-basic's resolveCompactSpec: threshold = min(0.8W,
W - maxTokens - 65536)). On a large window the quarter cut more than
compaction needs: DeepSeek's own deepseek-flash, 1000000/393216, was
listed at 250000, though all 393216 leaves dsh 541248 (54%).

Now the cap is max(W/4, W/2 - 65536): the output may take what leaves
dsh half the window to compact in, or a quarter of the window where that
is more (every window under 262144, where there is no half to spare
beside the headroom). A Max output the user set is still written as set
(outputOr), and contextWindow and /v1/models don't change.

dsh 0.2.0-rc.2's own resolveCompactSpec, run on the installed
compaction-basic over each figure (threshold tokens):

| window / output | vendor | quarter (main) | now |
| 524288 / 524288 | no message budget | 131072 -> 327680 | 196608 -> 262144 |
| 500000 / 393216 (#2823) | 41248 | 125000 -> 309464 | 184464 -> 250000 |
| 131072 / 65536 | no pressure budget | 32768 -> 32768 | 32768 -> 32768 |
| 1000000 / 393216 | 541248 | 250000 -> 684464 | 393216 -> 541248 |
| 400000 / 128000 | 206464 | 100000 -> 234464 | 128000 -> 206464 |
| 200000 / 393216 | no message budget | 50000 -> 84464 | 50000 -> 84464 |
| 128000 / 393216 | no message budget | 32000 -> 30464 | 32000 -> 30464 |

#2823's case stays fixed: 250000 is half its 500000 window (its
reporter's own plan A), against 41248 before 822f2b304; it is lower than
the quarter's 309464, which is the trade. The 128K and 200K windows
#3298 names don't change: any output above the quarter there takes it
straight out of what dsh compacts at, and a user who wants more sets Max
output.

Tests: TestDshOutputLeavesCompactionRoom's table takes the new figures
and adds DeepSeek's 1000000/393216 (393216), 200000 and 128000 windows;
its check now holds dsh's threshold at half the window where the window
has one, never under what a quarter leaves. TestDshModelLimits'
400000/128000 is now 128000; TestMaxTokensWithinContextWindow's dsh
figure follows the formula (its windows are all under 262144). Broken by
hand: the quarter alone (main) is red on 4 cases ("maxTokens 250000;
want ... 393216"), W/2 - 65536 alone on 3 (131072 gets 1), no cap
(pre-#2823) on #2823's own cases (524288/524288, 524288/1048576,
500000/393216, 131072/65536) and the 200K and 128K windows. docs/subsystems/agent-wiring.md says the new rule.

Run at 5adad1877 (this commit on top of item 4's): gofmt -l (nothing),
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... (all clean), go build for darwin, linux (nogui) and windows (ok),
and go test -tags nogui -timeout 45m ./...: all 69 packages ok, exit 0
(gateway 505s, agent 401s, provider 197s).

Not tried: a real DSH session against a 1M DeepSeek model through
magpie; the thresholds above come from dsh's resolveCompactSpec run
directly. Windows under ~87K (64000/384000 -> 16000) still leave dsh no
pressure budget, on main too; that needs a policy of its own and isn't
changed here.
2026-10-23 01:20:37 +08:00
yetoneandLoKi 822f2b3042 agent: dsh lists a vendor's reply limit at most a quarter of the window, so it has room to compact (#2823, LoKi on Discord)
dsh takes a model entry's maxTokens as the output of every request. Before
deciding when to compact, it reserves that output plus 65536 of headroom
out of contextWindow (dsh-compaction-basic resolveCompactSpec). When a
vendor's reply limit is close to its window, dsh compacts at a sliver of
the window, or can't compact at all. magpie now lists a vendor's figure
held to a quarter of the window (dshMaxTokens). It does this on every
pi-ai route and in the legacy llm-deepseek entry, the same rule VS Code
and Copilot in JetBrains already use. A Max output the user set stays as
they set it (outputOr).

LoKi's patch capped only an output >= the window. That misses #2823's own
case (a group at 500000 / 393216) and outputs above window - 65536, such
as 131072 / 65536. The quarter rule covers all of them, and a cap can only
lower the reservation.

Run: real dsh 0.2.0-rc.2 headless, sandbox HOME/DSH_HOME, a fake OpenAI
SSE server with a tool-call step so pre-step compaction runs, and an
observe-only loader hook on resolveCompactSpec.

  origin/main e5b57794e:
    524288/524288   "leaving no message budget"
    500000/393216   threshold 41248
    131072/65536    "leaving no pressure budget"
    1000000/393216  threshold 541248

  this change (maxTokens / threshold / retain):
    524288   131072 / 327680 / 62914
    500000   125000 / 309464 / 60000
    131072    32768 /  32768 / 15728
    1000000  250000 / 684464 / 120000

  The request's max_tokens matches each new value.

Tests: TestDshOutputLeavesCompactionRoom (every route plus legacy;
vendor, user-set, unknown window and unknown output cases).
TestDshModelLimits now expects 100000 for 400000/128000, and
TestMaxTokensWithinContextWindow (the every-agent guard, which the first
full run caught) holds dsh to a quarter of a known window.
Broken by hand:
  - dsh.go reverted: 4 vendor cases and TestDshModelLimits red.
  - Only the legacy writer reverted: 4 llm-deepseek failures.
  - outputOr dropped: the user-output cases red.
  - Old dsh.go under the new TestMaxTokensWithinContextWindow: 3 dsh rows
    red (32000, 51200, 16000).

Checks: gofmt -l clean. go vet darwin, linux -tags nogui and windows ok.
go test -timeout 45m ./... at e5b57794e plus this change, before the
sync_test fix: every package ok except internal/agent, where
TestMaxTokensWithinContextWindow was red (fixed here), and
internal/gateway, where TestDesktopSubagentUnsetDoesNotDecode was red (1
alloc, want 0). That is #2699, an allocation counted from another
goroutine in a whole-package run. It passes alone -count=3, and this
change touches no gateway code. After the fix, internal/agent ran whole
and was ok (2084s), and vet on all 3 OSes was ok again.

The Windows TempDir flake LoKi saw in
TestDshSetEffortWritesALegacyEntryWithTheCatalog did not reproduce: 10
runs of ^TestDsh on the Windows box passed. A goroutine/file probe at
each TestDsh cleanup (macOS and Windows) found no late writer. Filed as
#2982.

Co-authored-by: LoKi <317300729+lokic7123-star@users.noreply.github.com>
2026-10-20 03:12:29 +08:00
yetone 19e239c7bf vision: while a model that sees describes images, agents are told every model takes them (Discord, Fate: with Settings › Vision set, a text-only model in Codex still said it "does not support image input") — the gateway already described an image for a text-only model on every wire format, but the agents were told the model was text-only (Codex input_modalities ["text"], opencode modalities, dsh/omp input, droid NoImageSupport, cline/zed/qoder/workbuddy flags…), so they turned the image away before magpie was asked. provider.Described, set by the gateway to whether seer() finds a describer (Vision names one, or Automatic finds a model that sees; not with Vision off), makes magpieModels (every agent's model file) and codexListed (the ChatGPT backend's /models list and its ETag) say images for every model; Vision changed in Settings rewrites the agents' lists (catalog.Touched). TestDescribedModelsTakeImagesInAgentsLists (Codex list, input_modalities, tag) and TestDescribedModelTakesImages (agent files) fail on the old code and pass; TestDshModelLimits and TestMiniMaxCode turn Vision off to keep testing a text-only model as such. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried in the Codex App with a real account. 2026-10-03 15:25:43 +08:00
yetone 6953627b10 agents: DeepSeek Harness in a WSL distro (lgtm on Discord: wsl中安装的dsh,目前magpie还是扫描不到,可以添加上吗?) — dsh was this machine's only: dsh(home) read DSH_HOME and wrote the gateway's own address. It is now dshAt(place), as Empryo and the others are: its home is the distro's ~/.dsh (a distro's DSH_HOME can't be read), and the gateway it names in a profile's route, the legacy llm-deepseek entry and Check is the place's (gw threaded through dshSync, dshSet, dshSetEffort, dshCheck and the route writers). wslKinds lists it (dir .dsh, bin dsh); a stopped distro's thinking options come from magpie alone, as its patch lists can't be looked at. KeepDshWired stays this machine's: a distro's route is written again on a sync. TestWSLDshProfiles (a profile's route names 172.20.0.1, a sync and dshWiredOnce leave it) and dsh in wslMore (probe, pick, stopped) fail without it. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-03 11:17:55 +08:00
yetone 9845e3af51 dsh: magpie's route keeps the protocol picked for it in dsh's Models page, OpenAI Responses or Anthropic Messages, where each round put Chat Completions back (01huadalang on Discord: 这些协议怎么改 responses,在 dsh 改了一会就会被 magpie 接管) — the route was written whole each round, api: openai-completions included (dshRouteConfig), so a route switched to OpenAI Responses in dsh's Models page went back to Chat Completions within the 30 s the loop takes. Each round now reads the route's api from the profile's patch list and keeps it when it is one of the three llm-pi-ai protocols the gateway serves (dshAPI: openai-completions at /v1/chat/completions, openai-responses at /v1/responses, anthropic-messages at /v1/messages); none, or one the gateway has no endpoint for (google-generative-ai), goes back to openai-completions. The base goes with the protocol (dshBaseURL): pi-ai hands it to the vendor's SDK as it is, and Anthropic's adds /v1/messages itself, so anthropic-messages is at the gateway's root and the two OpenAI ones at its /v1 (as omp and Pi have it); dshCheck asks for the same base, so a route on Messages isn't reported as pointed elsewhere. On Messages a Claude that thinks only adaptively gets compat.forceAdaptiveThinking, which llm-pi-ai offers there, since pi-ai asks every other model for a thinking budget it turns away. reasoningEfforts are as before on all three: llm-pi-ai (0.2.0-rc.2) makes them pi-ai's thinkingLevelMap, sent as reasoning_effort on Chat, reasoning.effort on Responses (off as the map's none, a model without none having off hidden) and output_config.effort for an adaptive Claude on Messages. TestDshRouteKeepsTheAPIPickedInDsh (a loop round and a sync on a route set to openai-responses, to anthropic-messages at the /v1 base, to google-generative-ai and to none; dsh's check clean, a second round writing nothing) fails without the change (openai-responses written back as openai-completions). TestDshResponsesReachChatVendor sends pi-ai's Responses request, with dsh's User-Agent, to the gateway for a model served on Chat Completions alone: it is asked in Chat with reasoning_effort high, the image, tool call and output carried over, and the reply comes back as Responses events. Read from the installed dsh's llm-pi-ai and pi-ai only; no dsh profile, live agent config or running magpie was touched. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState failed once on its TempDir cleanup, passes alone). 2026-10-02 19:41:21 +08:00
Snowyy d5322cfbf1 agents: dsh's route is written again while magpie serves, not only when magpie starts (#528)
dsh resolves a session's model from the patch list before it contacts the gateway, so a
route that lists a model magpie no longer gives dsh fails every session, with nothing
reaching magpie to show for it.

While magpie serves the gateway it now writes the fields it manages on existing dsh
magpie routes again every 30s where they are not what magpie would write now, from
gateway.WhileServing next to the WebDAV sync. A route the user removed stays removed,
agent-default-model stays the user's choice, and an empty catalog writes nothing.
2026-10-02 15:37:07 +08:00
yetone 0361189f9e test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass. 2026-10-01 23:15:07 +08:00
yetone 471956c837 agents: dsh takes magpie as a custom provider of its own, Magpie, not by taking over its DeepSeek one (01huadalang on Discord: 集成进 dsh 会有 bug,会被 dsh 覆写,应该走 dsh 的那个另外的供应商) — magpie rewrote dsh's llm-deepseek entry in every profile to point at the gateway with the key MAGPIE_API_KEY. dsh's Models page showed it as DeepSeek, so a DeepSeek key typed there went into dsh's key store under that name, which dsh reads before .env: the next request carried the DeepSeek key and failed, magpie seemingly overwritten; dsh's own DeepSeek models were gone meanwhile. magpie now adds a magpie provider under llm-pi-ai, as dsh's Add model provider → Custom model API writes one (gateway URL, openai-completions, MAGPIE_GATEWAY_KEY, magpie's models with their limits, images and effort levels), and points the default model at it; llm-deepseek and the user's other providers are left alone, a profile wired the old way is moved on sync with its model and effort kept, new profiles get it, switching to a dsh model or clearing takes it out, and the check says when dsh's key store holds another MAGPIE_GATEWAY_KEY. Verified with dsh 0.2.0-rc.2 in a sandbox HOME against a fake gateway: headless and web requests carry magpie's token, a DeepSeek key saved in dsh's Models page no longer displaces it. TestDshCustomProvider and TestDshMovesOffDeepSeekRow fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. 2026-10-01 06:34:13 +08:00
yetone d2112865ef dsh: a profile DeepSeek Harness makes after magpie set it up gets magpie's model too (Discord 莫: 模型为什么WEB版本有,桌面版就只有官方自带的?) — every dsh profile has its own patch list (~/.dsh/profiles/<name>/cordis.patch.yml), and picking a model in magpie writes the ones there then. The desktop app's is made the first time it opens, so opened after the web's was set up it had none of magpie's entries and listed DeepSeek's own models alone, while Check read the web's (the first) and said all was well. Now Check looks at every profile and says which has none of magpie's models (the row's unwired mark, whose fix sets the model again in all of them), and the sync run at start-up and on each catalog change gives a profile with no llm-deepseek entry at all the model the wired one has; a profile with an llm-deepseek of the user's own is left as it is (reported, until the model is set again). Tested with a new TestDshProfileMadeLater (the web profile set, then a desktop template and a profile with the user's own entry: both reported, the sync fills the desktop's and leaves the user's untouched, setting the model again clears it; fails on main). go build -tags nogui (and GOOS=linux, GOOS=windows), go test -tags nogui ./... pass. Not tried with the dsh desktop app itself. 2026-09-29 19:59:20 +08:00
yetone 6694108bf2 agent: an agent whose own config keeps the reasoning effort its sessions start with gets an effort field, as Codex, Grok and Pi have — Claude Code's effortLevel (low to xhigh; max lasts a session only), Hermes's agent.reasoning_effort, omp's defaultThinkingLevel, Goose's GOOSE_THINKING_EFFORT, Copilot's effortLevel (the model's levels when its list says), Crush's large model reasoning_effort, Command Code's reasoningEffort for the current model (it keeps one per model) and dsh's llm-deepseek reasoningEffort (off, high or max, kept when the model changes or the catalog syncs); OpenCode, Gemini CLI, Cursor, ZCode, Devin and Alma keep none of their own in a file, so they get none. Asked on Discord 2026-09-26 23:29:40 +08:00
yetone 7174df1932 dsh: each magpie model says its context window, longest reply and whether it takes images — dsh otherwise takes a million tokens of context, 256K out and text only for every model, so a 128K model overflowed and a vision model was sent no images (#81); the longest reply comes from the catalog's output limit, a group's is its members' least; older dsh ignores the fields it doesn't know 2026-09-26 12:42:11 +08:00
yetone 4091b9dfd5 dsh: switching the model works on dsh 0.1.5 — it reads each profile's cordis.patch.yml (profiles/web, desktop, …) rather than ~/.dsh/config.yaml, so magpie writes there: agent-default-model for the model new sessions start on, and llm-deepseek naming its key as a credential (MAGPIE_API_KEY, in ~/.dsh/.env) since the entry no longer takes one; a model picked inside dsh, saved in its settings, gives way to one picked in magpie; older dsh keeps config.yaml as before; dsh's own deepseek-flash is on the list 2026-09-25 01:34:27 +08:00
yetone 96e44c67d5 agents: DeepSeek Harness (dsh) — its model picked in magpie like any other agent's: dsh's own V4 Pro and Flash, or any model magpie serves, which puts the gateway in ~/.dsh/config.yaml with the whole catalog in dsh's /model; the TUI, dsh -p and dsh web all start on it, the user's own entries stay, one magpie replaced comes back when it's set back to default, and a DeepSeek endpoint set in dsh's settings, which dsh puts over it, is pointed out (#27) 2026-09-24 20:22:22 +08:00