Edit a preset's tiers from the bar panel

The gear on every preset row now opens an editor: the four tiers with the
model each maps to, and for each one field that filters the provider's
catalogue as you type (every word must match; arrows and Enter work), listed
inline with context length and price, and that also takes any id typed by
hand. LM Studio's server form moves one click inside the editor.

The panel card moves from PopupCard to KeyboardPanel. PopupCard is an
xdg-popup, which only receives keys after focus is routed through its parent
surface, so no text field in it could ever be typed into - the existing
server URL form included. KeyboardPanel primes layer-shell keyboard focus on
open, which is why every shell panel with a text field uses it. Esc now
closes the panel.

The picker reads ~/.claude-mode/models-cache.json, which or_catalogue and
lms_catalogue now write as a side effect, so models, doctor, setup and the
menu's picker all keep it fresh and the panel never hits the network itself.
One node per provider with its own fetchedAt/ok; a failed fetch keeps the
old list, an LM Studio list is tied to its server, and no key or key name is
ever stored. `models` gains --preset, --refresh and --json, and the Z.AI list
now lives in one place.

A tier edit to the active preset re-applies without the running-sessions
prompt: that prompt guards against the endpoint or key moving, and a tier
edit moves neither (preset url/auth still ask). A failed re-apply now says
the edit was saved. `preset set` on an unknown name no longer creates it.

Panel edits run through one chain that stops on the first failure and
refreshes health.json at the end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
smoido
2026-09-15 00:14:30 +03:00
co-authored by Claude Opus 5
parent cbd3b1d8a9
commit 83b59f34a1
5 changed files with 797 additions and 47 deletions
+39 -6
View File
@@ -188,6 +188,9 @@ claude-mode preset rm <name>
claude-mode set-key [ref] [key] store a key (hidden prompt; [key] for scripts)
claude-mode models [filter] models available from the active provider
claude-mode models --preset <name> ...from that preset's provider (and server) instead
claude-mode models --preset <name> --refresh only update the cached list the panel uses
claude-mode models --preset <name> --json the cached list for that provider, as JSON
claude-mode doctor verify auth, endpoint, model ids, stray env vars
claude-mode preflight <mode> [preset] can this mode actually serve? (no switch)
@@ -201,6 +204,19 @@ claude-mode <mode> --force switch even when preflight says no
Omitting the preset uses a **fixed** per-provider default, not "most recently
used" — so `claude-mode openrouter` always means `default`.
Editing the active preset re-applies it straight away. For `preset set` and
`preset all` that happens **without** asking about running sessions: a switch
endangers them by moving their endpoint or key, and a tier edit moves neither.
`preset url` and `preset auth` do move them, so those still ask. If the re-apply
fails (a preflight refusal, say), the edit is still saved, and the last line says
so and names the command that finishes the job.
Every catalogue fetch — `models`, `doctor`, `setup`, the menu's picker — leaves
a copy in `~/.claude-mode/models-cache.json`, one entry per provider with its own
timestamp. A failed fetch keeps the previous list and marks it failed, and an LM
Studio list is tied to the server it came from. Model ids, context lengths and
prices only; no key or key name is ever written there.
## Presets shipped
One per mode, so `claude-mode <mode>` is never ambiguous and there is no
@@ -751,9 +767,13 @@ refresh it; the command exists for anything that wants to force it.
An icon in the Omarchy top bar showing which provider the next `claude` launch
will use, and a panel that switches it without a terminal. Install is
[up top](#omarchy-bar-widget). Both install steps hot-reload, so nothing needs
restarting — except after a change to `Modes.js`, which the QML engine caches
for the life of the process as a `.pragma library` (`omarchy restart shell`).
[up top](#omarchy-bar-widget). The shell notices the new files and reloads the
plugin, but on an **upgrade** that is not enough: it clears Qt's component cache
while the old widget is still alive, so the old compiled panel survives, and
`omarchy-shell shell rescanPlugins` does not shift it either. Run
`omarchy restart shell` after upgrading. The same goes for any change to
`Modes.js`, which the QML engine caches for the life of the process as a
`.pragma library`.
The icon is the mode, and it is the provider's own logo: the Claude burst, the
OpenRouter arrow, the Z.AI Z, the LM Studio mark. They are drawn as vector paths
@@ -798,9 +818,9 @@ CLI does, and both can stop it:
<mode>…* opens a terminal and runs the whole first-run flow there (a bar popup
can host neither a hidden key prompt nor a filter-select model list), *Store
the key…* opens a terminal for just the prompt, *Check again* re-runs the
preflight, and *Server settings…* opens the form below. The gear on any LM
Studio preset row opens the same form without waiting for a failure — per
row, because two LM Studio presets can point at two different machines.
preflight, and *Server settings…* opens the form below. For an LM Studio
preset the same form is also one click inside the preset editor (below),
without waiting for a failure.
The form holds the base URL, a *Use local default* reset, and a switch for
whether that server needs an API key. Saving rewrites the preset and drops
@@ -811,6 +831,19 @@ CLI does, and both can stop it:
strictly **after** the write — restarting first would only bring them back up
on the provider you just left.
- **The gear** on any preset row opens that preset in an editor: its four tiers,
each with the model it maps to. Clicking a tier opens one field that filters
the provider's models as you type (every word must match; ↓/↑ and Enter work),
listed with context length and price. That list comes from
the cache the CLI leaves behind, so the panel never touches the network on
its own. *Fetch models* / *Refresh list* runs `models --refresh` when it is
empty or old. Any id can also be typed by hand. The gear sits on each row
rather than each provider, because two presets of one provider map tiers
differently, and two LM Studio presets can point at two different machines.
Editing the preset in use applies it at once; see
[Commands](#commands) for why that does not ask about running sessions.
- **Esc** closes the panel. While it is open the panel holds the keyboard, as
every other shell panel does, so its text fields can be typed into.
- **Right-click** switches straight back to Anthropic.
- **Middle-click** re-reads state.
- **Hover** for mode, preset, and the opus/sonnet mapping.