Skip to content

feat(model-switcher): theme-style split-panel /model picker plugin - #696

Open
12britz wants to merge 5 commits into
mpfaffenberger:mainfrom
12britz:feat/theme-model-picker
Open

feat(model-switcher): theme-style split-panel /model picker plugin#696
12britz wants to merge 5 commits into
mpfaffenberger:mainfrom
12britz:feat/theme-model-picker

Conversation

@12britz

@12britz 12britz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a theme-style split-panel /model picker plugin (mirrors the /theme picker's look and feel), replacing the core single-pane model picker.

  • Left pane: paginated, filterable model list
  • Right pane: live preview — provider, context window, description, credential status, pinned agents
  • Interactions: ↑/↓ navigate, PgUp/PgDn page, type to filter, Enter to apply, Ctrl+E to edit credentials, Esc to cancel
  • Commands: /model (picker), /model <name> (switch by name), /model show (show active)
image

Bug fix included

The plugin's /model override was silently replaced by the core handler at first command dispatch: core_commands is imported lazily on dispatch and re-registered the core /model, clobbering the plugin (registered at cli_runner import time). The fix forces import code_puppy.command_line.core_commands before the plugin registers, so the override wins for the whole session.

Tests

  • tests/plugins/test_model_switcher_plugin.py (16 tests): command registration/override, by-name switching, filter, pagination, navigation, rendering, empty-catalog handling
  • ruff check + ruff format clean
  • Full tests/command_line/ suite (1940) still passes

12britz added 5 commits July 26, 2026 13:25
Replaces the core single-pane /model picker with a curated, /theme-like
split-panel experience: live preview (provider, context window,
description, credential status, pinned agents), pagination, filtering,
and Ctrl+E credential editing.

Fixes a load-order race where the plugin's /model override was silently
replaced by the core handler on first command dispatch: core_commands is
now imported before registration so the plugin override wins for the
whole session.
Rebuilding a fresh prompt_toolkit Application/Renderer inside the
credential-edit loop re-ran the CPR probe and re-entered its own render
loop every iteration. Interleaved with the manual alt-screen writes right
where the key listener hands stdin back, the CPR reply could be eaten on
Terminal.app, causing 'your terminal doesn't support CPR' and a flaky
second /model invocation. Mirror theme/picker.py: build one Application,
settle 0.05s before each run_async.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant