Skip to content

feat: add TUI /model — provider/model config CRUD and between-turns model switch#3

Merged
JasonJarvan merged 1 commit into
mainfrom
feat/tui_model_command
Jun 29, 2026
Merged

feat: add TUI /model — provider/model config CRUD and between-turns model switch#3
JasonJarvan merged 1 commit into
mainfrom
feat/tui_model_command

Conversation

@JasonJarvan

@JasonJarvan JasonJarvan commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Change description

Wire the TUI /model command end to end so a user can manage their provider/model config from the picker and switch model globally with between-turns effect (no restart). The vendored picker already existed but the backend answered model.* with method_not_found; this adds the real handlers and the live switch.

What changes:

  • New model.* RPC handlers: model.options / save_key / disconnect / add_model / remove_model. The model-name source is the user's manual config (providers.<slug>.models). OAuth providers are gated to the terminal raven provider login; api_base is required for custom/azure.
  • Model switch: config.set gains a model branch that persists agents.defaults.model (+ provider), rebuilds the provider via make_provider, and reassigns the live agent loop — guarded by is_turn_active (rejects a switch mid-turn), build-before-persist so a failed rebuild aborts cleanly. Effective on the next turn, no restart.
  • Providers: the custom provider is routed through LiteLLMProvider (it lacked chat_stream, so selecting it crashed every TUI turn), and a base LLMProvider.chat_stream non-streaming fallback is added so the remaining bespoke providers (azure/codex) degrade gracefully instead of crashing.
  • Config: ProviderConfig.models (manual catalogue) plus the writer helpers.
  • Picker (ui-tui): conditional api_base input (required custom/azure, optional other api_key, hidden OAuth), inline add/delete of model names, OAuth gating copy, and a structured switch through config.set; openrpc-derived TS types regenerated.

Type of change

  • Bug fix
  • New feature
  • Document
  • Others

Related issues (if there is)

N/A

Checklists

Development

  • Lint rules pass locally
  • Application changes have been tested thoroughly
  • Automated tests covering modified code pass

Security

  • Security impact of change has been considered
  • Code follows security best practices and guidelines

Code review

  • Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached as necessary

Notes: Tests — Python model / config / provider suites green (81 relevant pass) and the full unit regression shows no net-new failures; ui-tui tsc clean, build clean, full suite 854 pass / 16 skip. Lint not run in this branch (left unchecked). Security: no dependency changes; the credential write/read path (set_provider_fields / reset_provider) is unchanged; custom now flows through the existing LiteLLM env-setup path. Human smoke against the built TUI passed (provider/model CRUD + a real between-turns switch + a live turn).

…-turns switch

Wire the TUI /model command end to end: model.* RPC handlers
(options / save_key / disconnect / add_model / remove_model); a
config.set "model" branch that rebuilds the live provider and reassigns
the agent loop so a switch takes effect on the next turn (guarded by
is_turn_active); ProviderConfig.models for the manual picker catalogue;
the custom provider routed through LiteLLM; and a base
LLMProvider.chat_stream non-streaming fallback so non-litellm providers
degrade gracefully instead of crashing. Frontend: the model picker gains
an api_base input, inline model add/delete, and a structured switch
through config.set; openrpc-derived types regenerated.

Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>
@JasonJarvan
JasonJarvan merged commit 4507efb into main Jun 29, 2026
Kendrick-Song added a commit that referenced this pull request Jul 22, 2026
- Move _everos_server.py from raven/cli/ to raven/plugin/memory/everos/
  _server.py to fix plugin->cli layering violation (CR #1)
- Split HTTP timeout: client default 60s (recall/health), memorize
  add/flush per-request 360s (CR #2)
- Defer backend.start() to post-handshake background task in TUI so
  first render is not blocked by server startup (CR #3)
- Remove unused app_id/project_id from ImportSession and scanner
  (CR #4)
- Add note on per-source-unit checkpoint granularity (CR #5)
- Add fcntl file lock to prevent concurrent server spawn race (CR #6)
- Fix loguru %s format to {} in state.py (CR #7)
- Fix docstring step numbering (CR #8)
- Remove redundant Table import in status_cmd (CR #9)

Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com>
Kendrick-Song added a commit that referenced this pull request Jul 22, 2026
- Move _everos_server.py from raven/cli/ to raven/plugin/memory/everos/
  _server.py to fix plugin->cli layering violation (CR #1)
- Split HTTP timeout: client default 60s (recall/health), memorize
  add/flush per-request 360s (CR #2)
- Defer backend.start() to post-handshake background task in TUI so
  first render is not blocked by server startup (CR #3)
- Remove unused app_id/project_id from ImportSession and scanner
  (CR #4)
- Add note on per-source-unit checkpoint granularity (CR #5)
- Add fcntl file lock to prevent concurrent server spawn race (CR #6)
- Fix loguru %s format to {} in state.py (CR #7)
- Fix docstring step numbering (CR #8)
- Remove redundant Table import in status_cmd (CR #9)

Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com>
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