ac4af582301a4e8a29245dbba767eba31334ddf9
27
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bd0f338282 |
hermes: a Claude model goes on anthropic_messages, so cache_ttl 1h works; the user's api_mode stays (#5315)
cherish_onlyy (#5315): magpie wrote providers.magpie as chat_completions at the gateway's /v1 for every model. On chat completions to a custom provider Hermes sends no cache marks (anthropic_prompt_cache_policy gives (False, False)), and the marks magpie adds for a Chat client last five minutes, so prompt_caching.cache_ttl: 1h never reached the vendor. They set api_mode: anthropic_messages and the gateway's root by hand and got 1h writes; magpie's next sync or connect wrote chat_completions at /v1 back. Hermes takes api_mode per providers entry, never per model (_resolve_named_custom_runtime, hermes_cli/runtime_provider_custom.py; aliases in config_providers.py's _API_MODE_ALIASES, transport read when api_mode is absent). On anthropic_messages its adapter strips a trailing /v1 and the SDK adds /v1/messages, and for a "claude" model on a third-party gateway it puts its own system_and_3 marks at the configured ttl (agent/prompt_caching.py, read at d914e233). So magpie now writes two entries, as dsh already splits its routes: - magpie: chat_completions at gw/v1, every model not on Messages; - magpie-anthropic: anthropic_messages at gw (no /v1), the models whose native API is Anthropic's Messages and not Responses (hermesOnMessages). model.provider follows the picked model (hermesRoute), in every profile; a sync moves a Claude model magpie had set under "magpie" onto magpie-anthropic, and drops that entry when no model is left for it. Disconnect takes both out. The user's own value: an api_mode or transport on one of magpie's entries that isn't the one magpie writes there (by Hermes's aliases, so "openai" is still magpie's chat) is the user's (hermesModeIn). It stays through sync and pick, base_url follows it, and on "magpie" that entry then serves every model and no magpie-anthropic is written, which is the reporter's set-up exactly. magpie only ever wrote chat_completions into providers.magpie, so nothing earlier is mistaken for the user's. Tests: - TestHermesClaudeGoesOnMessages: Claude on magpie-anthropic (mode, base without /v1, models), deepseek stays on magpie at /v1, Get/Check/Drift clean, a pick moves model.provider back, a bot profile too, Disconnect removes both entries from every profile. - TestHermesSyncMovesClaudeOntoMessages: an existing connected config is moved on sync, and back when the provider goes chat-only. - TestHermesKeepsTheUsersAPIMode: api_mode anthropic_messages at gw, transport: anthropic, codex_responses: each survives two syncs and two picks, base_url kept; api_mode: openai is still magpie's. - internal/gateway TestHermesHourMarksReachTheVendor: a Hermes-shaped /v1/messages turn with 1h marks reaches the Anthropic upstream with every mark at 1h; the same turn on /v1/chat/completions goes at 5m. This one passes on the old code too: the gateway already passed the marks through; it guards that and records why the mode matters. Run (mote-run, this tree): - go test ./internal/agent/ -count=1 -timeout 45m: ok - go test ./internal/gateway/ -run 'TestHermesHourMarksReachTheVendor|TestResponsesToClaudeMarksLastAnHour' -count=1: ok - go vet ./internal/agent/ ./internal/gateway/, GOOS=linux and GOOS=windows: ok - gofmt -l: clean Broken by hand: - hermesSplit returning (nil, false), the old one-entry behaviour: ClaudeGoesOnMessages, SyncMovesClaude and the openai-alias case fail. - hermesModeIn never reporting the user's mode: all three KeepsTheUsersAPIMode cases fail at "sync". Not tried: - Hermes itself: it was not run (running it under a temp HERMES_HOME rewrites the live launcher); its behaviour is read from its source at d914e233. No real 1h cache write was measured against a vendor. - Group models whose members are all Claude, and Claude Code sign-ins (no Native API), stay on chat_completions; GPT on codex_responses is #3080. - Windows and Linux runs of the agent package (vet only). |
||
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
bb478f0e50 |
agent: a look that only ranges over magpie's models reads the list kept
magpieModels gives each caller its own copy of the list it keeps per
agent. Most callers only range over it, or count it, and a range copies
each model anyway, so the copy guarded nothing for them (the models'
own lists were shared before too: the copy was shallow). sharedModels
is the list kept, read only; every `range magpieModels(` and
`len(magpieModels(` in internal/agent (39 files) takes it. Callers that
keep the list, append to it or hand it on still get their copy.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls of /api/state, /api/providers and drift, pprof alloc_space
between two heap snapshots,
|
||
|
|
6712e367e8 |
agent: a look at the stash shares one read of it
Each /api/state and /api/drift poll asked the stash (stash.json) for one value hundreds of times, through Detected, Drift and the agents' wiring checks, and each ask read the file and parsed it again. In a real-account heap profile (20 rounds of drift, state and providers) stashLoad was 24-34 MB of what was allocated. stashShared reads it through filememo.Read, so every look shares one parse until the file changes, by magpie or by another process. Every read-only caller uses it now, the 24 files here and QwenPaw's unstashPeek. stashLoad, which callers change and write back, still gives each its own map, cloned from the same parse. Real use: the owner's real-account sandbox, offline (proxy to :9), 20 warm rounds of /api/drift, /api/state and /api/providers: - allocated 477 MB ( |
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
41427e016b |
agent: a stopped distro's Hermes profiles are never listed (#3924)
TestWSLColdPlaceOpensNothing is red on main since |
||
|
|
34d38ed669 |
hermes: each profile picks its own model on the Agents page
dongshanfengdongshizhcn on Discord: "我的 hermes 有多个 profile,但现在
agent 的配置里面,似乎只能配置默认的 profile". magpie gave Hermes one model
picker, for the connected profile's config.yaml. A bot under
<root>/profiles/<name> could only follow it or keep its own model.
Hermes's layout comes from its own source (hermes-agent e5ea5fd9,
hermes_cli/profiles.py and main.py): named profiles live in
<root>/profiles/<name> (PROFILE_ID_RE, a .deleted tombstone, the identity
files), active_profile is the sticky one, "default" is the root, and a
profile's model is model.default/model.model under model.provider. magpie
already found these profiles (hermesProfiles/hermesOthers).
Now each profile other than the connected one has a field,
"profile:<name>" (hermesProfileFields). The opened Hermes row draws them as
Other profiles, one line per profile: its name, the app's model picker, and
`hermes -p <name>`. They are never a square of the row's own, and with one
profile only nothing new shows. Nothing needs setting up:
- a magpie model stashes the profile's own provider and model, then puts
magpie's provider and the model into that profile only;
- a model of its own is written as model.default and gives back the stashed
provider;
- Default puts back the profile's model from before magpie, or keeps the one
it has. Disconnect sends the same empty value, so a profile never loses
its model;
- a bot picked there is recorded (hermes:<path>:picked) and doesn't follow
the connected config's next model (hermesFollow);
- a sync keeps magpie's provider current in a bot on magpie while the
connected config isn't on it.
app.js stays under its budget through the previous commit; no budget was
raised. New string: "Other profiles" (zh, zh-TW, ja, de).
Run:
- go test ./internal/agent ./internal/gui ./internal/profile ./internal/tui
./internal/cli (-count=1). gui, profile and cli are ok. Two reds were already
filed: TestFolderVarsAreListed (CARGO_HOME, fixed on main by
|
||
|
|
e54a7d50b9 |
agent: a stopped WSL distro's files are never opened, which started it again (#3896)
The reporter stopped Ubuntu-24.04 with "Detect agents in WSL" on, and magpie started it again within seconds. Opening any path under \\wsl.localhost\<distro> starts a stopped distro, and every /api/state did that: - wslAgentsOf built every WSL kind at a stopped distro's place, found or not, only to ask Detected(). Two builders read files even at a cold place: hermesActive read ~/.hermes/active_profile and dshAt listed ~/.dsh/profiles. Now only the kinds the probe found are built (the same test: wslAgent's detect is k.found), and both builders read nothing when the place is cold. - The Agents page asks every agent's pickers for options, and a stopped distro's agent kept the live options for fields with no asleep options of their own: Codex's memories and subagent effort read ~/.codex/config.toml (19 times a call), Grok Build's model read models_cache.json and config.toml, dsh's model listed its profiles. Each now has asleep options built from magpie alone: Codex's memories as its model, its subagent effort from magpie's catalog, Grok's from the live catalog, dsh's own models taken as 0.1.5 on (as its effort already was). TestWSLColdPlaceOpensNothing builds every kind at a stopped distro over a home with each kind's files, runs Values, Notice, Drift, Wired and every field's Options, and fails on any path under it the os package was asked to stat or open (-test.testlogfile). Red on the old code: the hermes and dsh reads from building, then the 19 Codex, the Grok and the dsh reads from the options. Run at the pushed head: tree |
||
|
|
56de2d1928 |
hermes: a model picked in magpie reaches the profile hermes starts in, and Off then On leaves every bot a model (tjhhhh)
tjhhhh on Discord (0.1.1673): switching the model of a Hermes profile
other than the default didn't take, and turning magpie's takeover Off and
On again lost the default model, so the hermes CLI failed at start.
Causes, read from Hermes' source (hermes_cli/main.py
_apply_profile_override, profiles.py):
- `hermes profile use X` writes <root>/active_profile, and every later
`hermes` runs profiles/X. magpie always wrote <root>/config.yaml, the
profile hermes no longer started in.
- At Off, hermesUnwireProfile deleted model.provider and model.default
from every profile on magpie and put nothing back. On rewrote only the
connected config, so the profile hermes ran had no model.
Now:
- hermesActive: the config magpie connects is the profile hermes starts
in: HERMES_HOME when it names a profile, else active_profile's (BOM and
whitespace trimmed) when it is a live profile (not "default", a valid
name, no tombstone, its folder there), else the root.
- Off leaves each bot on magpie on a model it can start with: its own
stashed model if it had one, else the connected config's own model,
with that provider's providers.<name> entry copied in when the bot
lacks it. What magpie put there is kept as hermes:<path>:off.
- On puts magpie back on each bot still on what Off left (hermesBack); a
bot the user moved while Off keeps theirs; a bot with no model at all
gets magpie's.
- Bots on the model magpie or hermes last picked follow a new pick
(hermesFollow now also follows the connected config's current default).
- gone.go: a profile folder's Agent finds the root's hermes-agent
checkout, so it counts as installed.
Run:
- go test -tags nogui -count=1 -run 'CLIMissingHermes|Hermes'
./internal/agent: ok.
- New tests red on the old code: TestHermesStickyProfile
(hermes_test.go:811 'active_profile "coder\n": connects .../.hermes,
want .../.hermes/profiles/coder'), TestHermesOffAndOnKeepsEveryBotsModel
(hermes_test.go:698 'off: writer is on {Provider: Default:}, want
{Provider:mine Default:kimi-k3}'), TestHermesBotsFollowTheModelHermesPicked
(hermes_test.go:768 'writer stayed'); TestHermesProfiles' writer after
disconnect now expects the root's own model, not nothing.
- Whole internal/agent (-timeout 45m, logged): the disk filled (other
sessions' temp files, under 1 GB free) and 43 tests failed on "no space
left on device"; each of them, and every Hermes test, passed on a rerun
(131s). TestFolderVarsAreListed is red on main since
|
||
|
|
a6c808b688 |
hermes: every bot still on magpie's model follows the model magpie sets (tjhhhh_84378)
Hermes copies the launch profile's model block into a new profile
(hermes_cli/profiles.py _seed_model_config, or --clone's config.yaml) and
never reads the main config again. magpie put its provider into each
profile but left each profile's model alone, so after a model change in
magpie every other bot (profile) still opened on the model magpie had set
when it was made (tjhhhh_84378 on Discord, with the Hermes gateway closed).
Now picking a magpie model for Hermes also moves each other profile whose
model.provider is magpie and whose model.default (or model.model, which
Hermes reads with default unset) is the model magpie had set onto the new
one (hermesFollow). "The model magpie had set" is recorded in stash.json
(hermes:<path>:magpie.default); for a config connected before the record,
it is the connected config's own magpie model. A profile on any other
model, magpie's or its own, was set by its user and is left alone, also
when it is on a model magpie used before. Disconnect forgets the record.
A profile made after the change is seeded from the current config, so it
starts on the new model already. RenameProvider goes through the same
field Set, so a renamed provider moves the following bots too.
Test: TestHermesProfilesFollowMagpieModel (internal/agent): a seeded bot
and a model.model bot follow pro -> flash (no record yet) and, through an
own model on the main config in between, -> max; a bot on magpie's
deepseek/lite and a bot on its own provider stay; a bot its user moved
back to the previous magpie model stays. On the old hermes.go it fails:
hermes_test.go:613: flash: writer is on magpie/deepseek/pro, want magpie/deepseek/flash
Run:
- gofmt -l internal/agent: clean. go vet ./internal/agent on darwin,
GOOS=linux -tags nogui and GOOS=windows: ok, at this commit (rebased
onto origin/main 689cf4142; nothing under internal/agent changed in the
rebase).
- go test -tags nogui -count=1 -run Hermes ./internal/agent at this
commit: ok (33.6s). Whole ./internal/agent before the rebase: ok (307s).
- Full suite, go test -tags nogui ./... -timeout 45m -count=1, sandbox
HOME, at a57d2460b (this change on
|
||
|
|
b9d1cd36f5 |
agent: Hermes's api_key as "${VAR}" with the key in its .env reaches magpie (PaulT on Discord)
PaulT (magpie 0.1.1291) keeps Hermes's key the way Hermes keeps keys:
providers.magpie.api_key: "${MAGPIE_API_KEY}" in config.yaml, the key in
~/.hermes/.env. Hermes expands ${VAR} and ${env:VAR} as it loads the
config (hermes_cli/config.py _ENV_REF_RE, _env_expand_match), from the
.env beside it, which load_hermes_dotenv loads over the environment.
magpie compared the literal "${MAGPIE_API_KEY}" with its key, so Check
marked Hermes as needing attention, and a sync (mergeKept) wrote the
literal key over the reference.
Now hermesKey expands the reference the way Hermes does: the .env
beside the config (main or a profile's), then this machine's
environment. Check reads that key through keyHolds, so magpie's key or a
Gateway key is not drift. A variable magpie can't see (only a shell
profile sets it) or another secret source (${vault:...}) is unknown:
not drift, and kept. A sync or pick keeps the reference
(hermesKeptKey). When it names a key the gateway doesn't take, magpie
keeps the reference and writes its key into that .env under the
variable (made 0600 when there was none). A value with more than the
one reference in it is replaced by magpie's key, as before.
Siblings not covered here: other agents whose configs take env
references in the key (Droid's "${VAR}", OpenCode's {env:VAR}) still
compare literally.
Test: TestHermesWithAKeyInItsEnvFile uses the reporter's provider block
as written: a Gateway key and magpie's own (quoted, export) in .env,
${env:VAR} from the environment, an unseen variable, a wrong key (.env
rewritten in place, other lines kept), and a composite value.
Broken by hand: with hermes.go at origin/main it fails "a gateway key in
.env is drift: Hermes's api_key (config.yaml) was changed"; with only
the sync half removed it fails "the user's reference was written over".
Run (worktree, sandbox HOME, GOCACHE pinned, macOS, load ~300):
- gofmt -l internal/agent: nothing. go vet ./..., GOOS=linux go vet
-tags nogui ./..., GOOS=windows go vet ./...: ok (at
|
||
|
|
2b0037f41d |
sessions: a Claude Code, Qoder or Cowork project folder, a session's folder or a Hermes profile behind a junction is read, not skipped (#2268, JasonBuildAI)
On Windows os.ReadDir lists a junction as ModeIrregular, neither IsDir nor ModeSymlink, so a reader that goes into only IsDir() entries, or IsDir() and ModeSymlink ones, walked past a folder kept on another drive with a junction left in its place. ccFiles (Claude Code's own store, Qoder's, Qoder CN's and Cowork's) skipped such a project folder whole, a session's own folder (its subagents) and a workflow run's; HermesDirs skipped such a profile. Sessions and Usage lost all of them, silently. #2233/#2250 fixed walk roots (walkLinked); this is the entry check one level in. dirent.IsFolder is the one check now: an entry is a folder to read into when it is one, or when it is a symlink or irregular entry that os.Stat follows to a folder. A link to a file, a broken link and other irregular entries are none. It follows only the entry asked about; none of its callers recurses through one, so no visited set is needed. Used at every reader of an agent's folder that picks entries this way: - sessions: ccFiles' project, session-folder and workflow-run checks, HermesDirs' profile check, agyCallFiles' conversation check (IsDir only before, so even a symlink was skipped); - agent: hermesProfiles and ompProfiles (IsDir only), so a linked profile still gets magpie's provider and its own row; - library: desktopSkillRoots' org and account folders (IsDir only). Left as they are, on purpose: WalkDir copies, hashes and deletes in library and sessions/manage.go (they must not follow links), the relocate code (it tells a link from a folder on purpose), library's linkEntry (asks "is this a link", not "is this a folder"), magpie's own folders (calls cache, gateway logs, OthersDir, backups, Bun, Devin homes), and install/version detection (claudecode versions, VS Code extensions, Desktop's folder name, Hanako's agents). The issue's patch had sessions' own copy of library's linkEntry without a Stat; this is a shared package and Stat-checked, so an irregular entry that isn't a folder (a dedup or cloud placeholder file) isn't read as one. docs/subsystems/gateway-sessions.md says how the readers treat links. Run: - New tests make real links, a junction (mklink /J) on Windows and a symlink elsewhere: TestIsFolder; TestClaudeProjectFolderBehindALink, TestClaudeSessionFolderBehindALink and TestHermesProfileBehindALink (the issue's), TestClaudeWorkflowRunBehindALink, TestAgyConversationBehindALink; agent's TestHermesProfileBehindALink and TestOmpProfileBehindALink; library's TestClaudeDesktopSkillRootsBehindALink. - Broken by hand on macOS (IsFolder = e.IsDir()): all nine fail. Broken as before on the Windows box (IsDir() || ModeSymlink, no Stat): TestIsFolder and all eight reader tests fail there (e.g. "Claude session files behind a link: [], want [...]", "Hermes sessions behind a link: 1, want 2", "agy calls behind a link: 3, want 5"); with the fix all pass. Windows test binaries cross-built with go1.26.8 (windows/amd64, nogui) and run on the box with a fresh sandbox USERPROFILE/HOME/APPDATA/LOCALAPPDATA/TEMP per run. - Whole packages on the Windows box: dirent and sessions pass. usage, agent and library each have reds that fail the same with binaries built from origin/main |
||
|
|
2eee900dc9 |
agent: eight more syncs keep what the user set on magpie's block (#2030's siblings)
|
||
|
|
250bdd5c4f |
gui: Names in agents' lists names the connected agents it changes nothing in (love1sbug on X)
love1sbug on X found Names in agents' lists seemed to do nothing. Claude Code and Qwen Code follow it now; a sweep of every agent in a sandbox HOME (each set to one relay model, the setting switched, the files compared) found the rest that follow it, and those that can't: - handed the models' ids alone, their formats having no name for one: Goose, jcode, Hermes Agent, Reasonix Studio, AtomCode, fx, Antigravity CLI, AstrBot, Mister Morph; - with no list of magpie's models: Gemini CLI, Snow CLI; - reading the gateway's /v1/models themselves, whose display_name is the name alone on purpose (a remote magpie relies on it): Empryo, Cursor Private Inference. Those carry agent.NoNames (copied to an agent in WSL), sent to the GUI as noNames. Where the setting is offered (Settings › Provider in model names, Routing's Names in agents' lists, a provider's Names & levels) a line names the connected ones: "Changes nothing in Goose, Hermes Agent: magpie's names don't reach their model lists", in every language. With none connected nothing is said, so the Settings row keeps no line under its name (1ooogle on X, model-suffix-own's check). A page drawn before the agents are read (Routing, an open provider editor) says it once they are (redrawNoNames, beside redrawSuffix). name-suffix-no-names.test.cjs checks the three places in chromium and webkit, en/zh/zh-TW/ja/de, at 900px and 390px with no sideways scroll, that an agent not connected or following it isn't named, that none says nothing, and, with /api/state answered 1.5s late, that all three still say it. On the old assets 12 of the first 13 chromium tests fail; the late case failed on this commit's first version too (found when a loaded run failed the editor's case; reproduced with the injected delay). Run: that test and i18n-keys, gateway-mode, model-suffix-own, name-suffix-remote, name-suffix-saved, name-suffix-where-named, settings-general/groups/search/sections in both engines; go test -tags nogui ./internal/agent ./internal/gui ./internal/provider ./internal/gateway (before the rebase); gofmt -l; go vet darwin/linux/windows. With 11 files at once at load 80-120, webkit failed once on this test's "no page errors" check (ja 900px, the late case) beside settings-sections' "Settings in parts"; not reproduced in 3 runs since (10 files, then 8 copies at once), and the errors weren't kept. Not tried: the GUI against a real magpie with Goose connected. |
||
|
|
e08902e79d |
agent, library: Hermes Agent's folder is %LOCALAPPDATA%\hermes on Windows, and rtk's installer is told it (新v学员 on Discord)
新v学员 runs magpie on native Windows. Library -> RTK -> Hermes Agent
failed with "rtk's installer didn't add its hook to Hermes Agent:
Config: C:\Users\admin\AppData\Local\hermes\config.yaml ...". magpie
hard-coded ~/.hermes. Hermes' own default
(hermes_constants._get_platform_default_hermes_home) is
$LOCALAPPDATA\hermes on win32 (~/AppData/Local/hermes when LOCALAPPDATA
is empty) and ~/.hermes elsewhere, with $HERMES_HOME overriding it.
rtk 0.51's resolve_hermes_home knows only $HERMES_HOME and ~/.hermes,
on every OS.
What changed:
- appdir.HermesHome / HermesHomeIn / HermesDefaultIn: $HERMES_HOME,
else Hermes' per-OS default. This is the one place that resolves it.
- agent: hermesIn (Agents-page model wiring) and hermesProfiles use it
through place.hermesHome / hermesDefault. A WSL distro keeps
~/.hermes (Linux paths, Windows env not read). The Agents-page wiring
was wrong on native Windows too: without HERMES_HOME it wrote
%USERPROFILE%\.hermes\config.yaml, which Hermes never reads.
- sessions.HermesDir uses it, so Windows sessions are found.
- library/rtk: the hermes spec reads and writes the agent's own folder
(a.Dir), and rtkSpec.env passes HERMES_HOME=<that folder> to
`rtk init -g --agent hermes --auto-patch`.
- Tests resolve the folder through appdir instead of home/.hermes. New
TestHermesDefault/TestHermesHome (appdir), TestHermesFolder (agent:
Windows default, profiles under it, WSL unchanged), and
TestRTKHermesHome (library, a fake rtk that behaves like 0.51).
- docs/reference.md and docs/subsystems/library.md describe the
Windows folder and the env.
Run:
- gofmt -l clean. go vet ./... on darwin, GOOS=linux -tags nogui and
GOOS=windows.
- darwin: go test ./internal/appdir ./internal/library
./internal/sessions ./internal/agent ./internal/tui.
- TestRTKHermesHome against the old rtk.go fails with the reporter's
exact message ("didn't add its hook ... AppData/Local/hermes/
config.yaml"), and its default subtest fails with HERMES_HOME="".
- Windows box (cross-compiled test binaries, testenv sandbox
USERPROFILE/LOCALAPPDATA): appdir Hermes tests, agent
Hermes|Reseat|Effort (incl. TestHermesFolder) and library Hermes|RTK
pass. TestRTKHermesHome skips there (shell fake). The sessions binary
failed only TestHermesMessageVisibility, because its testdata wasn't
copied to the box.
- Real rtk.exe 0.51.0 on the Windows box: with
HERMES_HOME=<sandbox>\AppData\Local\hermes it wrote the plugin there
and patched that config.yaml. Without HERMES_HOME it wrote
C:\Users\<user>\.hermes, ignoring a sandbox USERPROFILE (rtk asks
Windows for the home folder). That confirms the cause and the fix.
The stray folder it made on the test box was removed.
Not run: real Hermes on Windows (no install, and running hermes under
a temp HERMES_HOME rewrites the live launcher); the GUI suite; the full
go test ./... ; the reporter's own machine.
|
||
|
|
6ebe481f8e |
agent: Hermes's other bots (profiles) get magpie's provider too, and Disconnect takes it out of each (lijiho96940561 on X)
Each Hermes bot is a profile at <root>/profiles/<name>/ whose config.yaml
is read on its own (hermes_cli/config.py get_config_path; load_config
doesn't fall back to the root's). magpie wrote providers.magpie only into
$HERMES_HOME/config.yaml, so only the main bot's picker offered magpie.
Now, with magpie connected, its provider entry also goes into the
config.yaml of every profile Hermes lists (hermes_cli/profiles.py and
hermes_constants.py, Hermes be5e9f72c): a name matching PROFILE_ID_RE,
not "default", not tombstoned under profiles/.deleted/, with a config.yaml.
The root follows get_default_hermes_root: ~/.hermes, or for a HERMES_HOME
outside it, <root> of <root>/profiles/<name>, else HERMES_HOME itself.
Connecting writes it there, and each Sync refreshes it and adds it to
profiles made later. Only providers.magpie is written, so each bot's own
model.default/model.provider stays as its user set them. Disconnect deletes
providers.magpie from every profile. In a profile whose model.provider is
magpie (cloned from a connected main config, or picked in that bot), the
model and provider are deleted too, so the profile isn't left naming a
provider that is gone. There's no stash for those, so Hermes falls back to
its defaults there.
Run: go test ./... -count=1 under a scratchpad HOME (all ok); gofmt -l; go
vet ./internal/agent for darwin, linux and windows. TestHermesProfiles and
TestHermesProfilesOfCustomRoot fail on the old hermes.go ("coder after
connect"). Fixtures follow Hermes's profile layout, read from its source.
Not tried with a real Hermes running several bots; the live ~/.hermes was
not touched and hermes was not run.
|
||
|
|
20582866a5 |
agent, gui: an agent's advice after a change reads in the window's language (#1508, NovaTrailX)
A Chinese window said "ZCode 已接入 magpie. ZCode reads its providers at
start-up — restart ZCode …": the notice an agent gives after a change
(state.notice) was English text written in place in each agent's file, and
i18n.js had no entry for any of them.
What changed:
- internal/agent/notice.go: a notice is a template registered with
newNotice ("Restart {agent} to …"), filled with say(kv...); Notices()
lists every one. All the agents' notices (claude, codex daemon, zcode,
agy, cursor-local, wsl, AstrBot's added today, …) are now such templates, the issue's list
being a sample of them.
- i18n.js: every template has a zh, zh-TW, ja and de translation, and
NOTICES lists them. tNotice() reads a notice of several joined: longest
template first, a {slot} never runs over a sentence's end, and a notice
with any part that has no template (a plugin's own) reads as given
rather than half in each language. withNotice() joins the status line
and the notice with 。 in zh/ja.
- app.js: the six places that showed state.notice use withNotice.
Tests:
- TestEveryNoticeIsTranslated: every Notices() template is in NOTICES and
in each language table, with the same slots. Fails with the zh ZCode
line deleted from i18n.js (tried).
- TestNoticesAreTemplates: an AST scan for English written in place as a
Notice. Fails with zcode.go's literal put back (tried).
- tests/agent-notice-lang.test.cjs: every template, filled, alone and
joined, plus a plugin's notice, and connecting ZCode as the reporter
did; en, zh, zh-TW, ja, de at 1100 and 420px, Chromium and WebKit:
22/22. Its zh subtests fail without the zh line.
Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; the full GUI suite (node --test, both engines, -concurrency 6,
machine load ~140): 5130/5195, 64 failing in 22 files. Rerun alone, 16
files pass; mobile-web, old-webkit, panel-usage and routing-context/
group/keys-fold fail the same on the base commit,
|
||
|
|
ed4476b981 | agent: Hermes keeps magpie's provider when its model goes to one of its own, so it stays connected and its session picker still offers magpie's models; Disconnect takes it out (lijiho96940561 on X: changing Hermes's default model marked it Not connected and magpie's models left its picker) | ||
|
|
17f790b145 |
agent: five package-level twins nothing calls are gone — isCodexGateway, ccProviderJSON, fxProvider, hermesProvider and writeMiniMaxEntry
Each was a one-line wrapper of its *At function for the local gateway. The callers moved to closures of the same name over the agent's own address (at.v1(), at.gw()), which shadow the package function, so the wrappers were reached by nothing, tests included (deadcode -test). Their doc comments now sit on the *At functions, and isCodexGatewayOn has its own again: it had been left above codexKeptGateway. go vet (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./internal/agent under a temp HOME pass. |
||
|
|
e77a373792 | agent: every agent in a WSL distro under NAT is given the LAN sharing key, not "magpie" (whqtian on Discord) — v0.1.972 gave it to omp only, and OpenCode in WSL was still written "apiKey": "magpie" with Windows' address, which the gateway takes from loopback only. keyAt(gw) is the key for a gateway URL: the LAN sharing key when the URL isn't this machine's and sharing is on, else gateway.Token; OpenCode (and MiMo Code), Crush, Pi/omo, Codex, Claude Code, Kimi Code, Hermes, Grok, MiniMax Code, Droid, Morph, dsh, Qoder/Qoder CN and omp write it, their Checks compare against it (an old "magpie" there shows as drift), and ourKey still sees a LAN-keyed config as magpie's. TestGatewayKeyBeyondLoopback fails without the change. go vet ./..., go test -tags nogui ./internal/agent ./internal/gui ./internal/gateway ./internal/access ./internal/provider under a temp HOME, GOOS=linux/windows go build pass. | ||
|
|
165fee0df5 | agent: an agent's own provider named as one of magpie's isn't magpie's, in every agent that spells a model provider/model (the rest of #835) — OpenHanako's own deepseek/deepseek-v4-pro read as magpie's deepseek, and so did a model of any agent's own provider whose name magpie has a provider by: Pi's, Crush's, Hermes's, OpenCode's relay/glm-4.6 with magpie's relay had the row connected on the agent's own model, and Disconnect from magpie put that model back and left the row connected. An agent says how magpie's values are spelled in it (Spelled, replacing #835's Prefixed): magpie/<ref> for Antigravity CLI, Pi, OmO, Aside, Goose, Zed, VS Code, Crush, DeepSeek Harness, Command Code, fx, omp, Hermes, Mister Morph, Kimi Code, Empryo, MiniMax Code, Droid, Qoder, Qoder CN, Grok Build, AtomCode, Cline and OpenHanako, whose every Get spells magpie's so (a sandbox Set of magpie/relay/glm-4.6 read back as that in each); for OpenCode, MiMo Code and OpenChamber also a provider of the config's own that sends to magpie's gateway, as openCodeRef names a model there. A stopped WSL distro's agent keeps its live one's. Left as they are: Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, Copilot, Devin (magpie's are bare refs there), Muse Code (a model with / is magpie's by design: Meta's have none), Alma (its own are providerId:model), Air (magpie's only). TestOwnProviderNamedAsMagpies (26 agents: own relay/glm-4.6 not connected, Connect, Disconnect puts it back and the row is off) fails on the old code in each; TestOpenCodeGatewayProviderIsMagpies. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
dd70a4055a | wsl: OpenCode, Kimi Code, omp and the other CLIs magpie sets up through a file in the home are set up in WSL distros too (#515: on Windows only Codex, Pi, OmO and Claude Code were found in a distro) — fourteen agents join wslKinds, each found by its folder under the distro's $HOME or its command on the distro's own PATH, and listed as <name> · WSL <distro> (opencode@wsl:Ubuntu…): OpenCode (~/.config/opencode, opencode), MiMo Code (~/.config/mimocode, mimo), Kimi Code (~/.kimi-code, kimi; the old kimi-cli's ~/.kimi where that is all there is, found by the command), omp (~/.omp/agent, omp), Crush (~/.config/crush/crush.json, Linux's place, not Windows' LOCALAPPDATA), Hermes Agent (~/.hermes), Grok Build (~/.grok, by its folder alone, as on this machine), Droid (~/.factory), fx (~/.fx, by its folder alone: fx is also the JSON viewer), Command Code (~/.commandcode), MiniMax Code's mcode (~/.minimax), Muse Code (~/.config/muse), Qoder and Qoder CN (~/.qoder, ~/.qoder-cn). Each is its host constructor at a place (opencodeIn, kimiIn, ompIn, crushIn, hermesIn, grokIn, droidIn, fxIn, commandCodeIn, miniMaxIn, museIn, qoderIn/qoderCNIn; the host's opencode(home, cfg) and the rest wrap them), so it writes the same keys and schema as on this machine, but the gateway as the distro reaches it (place.gw/v1: 127.0.0.1 when mirrored, Windows' address under NAT) in its provider, its Check and its Sync, and its folder at the default, as the distro's variables (OPENCODE_CONFIG_DIR, KIMI_CODE_HOME, HERMES_HOME, FACTORY_HOME_OVERRIDE, MINIMAX_DATA_DIR, QODER_CONFIG_DIR…) aren't read (place.getenv is "" there); OpenChamber, a Windows app, isn't looked at for a distro's OpenCode, and omp there, whose version isn't known, gets xhigh rather than a max an older omp refuses. Their notices are the restart advice of their own, as for Codex. A stopped distro's agent is built without looking at its files (place.cold: exists/isDir are false, so the defaults are taken), its options read none (wslOwnAsleep, kimiOwnOptions/ompOwnOptions/miniMaxOwnOptions without a file), and a pick, once the distro is started, builds the agent again warm, so it writes the file the agent reads — an opencode.jsonc already there, ~/.kimi for kimi-cli — not the default. Left out: Gemini CLI and Antigravity (a key lent through .env, a launch command), dsh (profiles and .env), Devin (no gateway; its model list from the devin command on this machine), Goose (no magpie routing; its name is pressly's goose too), Cursor and Copilot (no magpie routing), and the apps (Cline, Hanako, WorkBuddy, ZCode, Claude Desktop, OpenChamber, Alma, Cindy); and the library's skills, MCP and instructions for the new WSL agents, which wslTargetOf still gives only Claude Code, Codex, Pi and OmO. Nothing ran on Windows or in a real WSL. wsl_more_test.go, on fake distro roots under temp dirs with the host's variables pointed elsewhere: TestWSLProbeFindsMoreAgents (each folder and command in the probe, none for grok and fx, kimi-cli by its command), TestWSLMoreAgentsDiscovered (all fourteen listed, no command, UA or aliases), TestWSLMoreAgentsPick (each agent, mirrored and NAT: its file in the distro names the distro's gateway, no 127.0.0.1 under NAT, Check passes, Sync keeps it, the notice; this machine's home and the folders its variables name untouched), TestWSLMoreAgentsStopped (nothing asked nor opened, the last value shown, options, a pick starts the distro and writes there) fail without the change; TestWSLStoppedPickFindsItsFiles fails without the warm rebuild (the pick wrote a second opencode.json beside the .jsonc). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build and vet ./internal/..., GOOS=windows go test -c ./internal/agent/ ./internal/library/, and go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState failed once on its TempDir cleanup race, passes on the rerun; untouched). | ||
|
|
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 | ||
|
|
73be42eca8 | models: each agent can be shown only some of them — a provider or group gets a family (magpie provider set relay-x family=relay), and magpie visible zcode relay shows zcode only that family's models (or named providers and groups): in the files magpie writes for it and in what /v1/models answers it, told apart by its User-Agent; magpie models zcode lists what it is shown and what is kept from it, and magpie visible zcode all shows it everything again. A model kept from an agent is still served when asked for by name. Asked for on Discord | ||
|
|
1b5d1f87db | agent: every agent on a magpie model says when it was taken off magpie behind its back, not only Codex — each checks what magpie wired into it to reach the gateway (Claude Code's env base URL and token, and a managed-settings base URL that wins over them; Gemini CLI's .env and its auth type; OpenCode, Pi, Crush, Command Code, Hermes, omp and Grok Build's magpie provider; DeepSeek Harness's llm-deepseek entry and its key in .env), and one pointed elsewhere or gone shows Apply again with what is off in its tooltip; Claude Code, like Codex, is also said to be bypassed when it was used and nothing of it reached the gateway (its history.jsonl), and slash commands no longer count as use. A test takes every such agent off the gateway and back | ||
|
|
09c635cf03 | agents: a model through magpie tells Pi, Crush, omp and Codex how much it holds, and a provider added, edited or removed reaches the model lists agents keep in files of their own — the catalog carried no context window, so Pi took every model through magpie for a 128K one (a CLIProxyAPI's gpt-5.5 holds 922K) and Crush for a 200K one; each model now carries models.dev's input limit, else its context, looked up by bare id as most of the providers serving it give it (a proxy's "openai/gpt-5.4", "gpt-5.4(high)", "glm-4.6:free" find it too; a group holds the least of its members'). And those lists were written only when a model was picked: Codex's magpie-models.json, Pi's models.json, OpenCode's, Crush's, Command Code's, omp's and Hermes' provider blocks and dsh's llm-deepseek entry kept the catalog as it was then, so a provider added later never showed. Saving a provider, a vendor's list fetched anew or models.dev synced now rewrites each one magpie wrote, where it differs, and the app does once at start-up; a Codex signed in to ChatGPT, which asks the gateway, kept its cached list under the backend's ETag, which a change of magpie's never changed — the ETag (and a reply's X-Models-Etag) now carries a tag of magpie's models, and a cache from before a change is aged so the next Codex asks again | ||
|
|
b72985a9cc | agent: add Hermes Agent (#49) — magpie adds itself to ~/.hermes/config.yaml ($HERMES_HOME) as the provider "magpie" under providers (the gateway as chat completions, the catalog as its models) and points model.provider at it, with the model in model.default; the provider and model the user had are stashed and put back when they pick one of Hermes's own or go back to the default. Hermes sends its own User-Agent only from a recent release on, so the entry sets it for the gateway's usage view |