Repository navigation
Description
What problem does this solve?
The TUI lets the user see the available models, switch the model for the session (Ctrl+L picker, Ctrl+P cycle, /model) and set the thinking level (Shift+Tab, /thinking: minimal, low, medium, high, unset). tole serve has no route for any of it, so a graphical client has no model picker and no thinking selector.
Found while writing the screen inventory for #561 (screen 8, gap C). It blocks screen 8 of the desktop and web clients (#527, #529); a first mobile client (#528) can do without it.
Why this one needs care
Choosing a model also chooses what the token holder spends, and a model setting is part of what a session does later (it survives resume). So the server, not the client, has to decide which models may be picked.
Proposed solution
Three small routes, behind the existing bearer token:
GET /models: the models the server allows a client to pick (from the server's own configuration and the provider's/models, filtered by an allow list), plus the current default. A client can only pick from this list.POST /sessions/{id}/model {"model": "<id>"}: sets the session model. It writes the samefact/modelregister the TUI writes, so the choice survivestole resume.400for an id that is not in the allowed list,404for an unknown session,409while a turn is running (the TUI refuses commands then, because they need the session lock).POST /sessions/{id}/effort {"effort": "low" | ... | null}: sets or clearsfact/reasoning_effort, with the same validation and refusals as--effortand/thinking.
An invalid level is refused loudly (as session_effort_e2e already tests for the CLI), never silently coerced.
Alternatives considered
- Let the client send any model id: simplest, but the token would then choose spend and provider routing freely.
- Only a read route (
GET /models) and leave setting to the host: no picker, which is the point.
Open question for the owner
Is the model picker part of the first desktop release? If yes, this issue goes before #527 starts. If not, the first release ships a fixed model and this stays open.
Acceptance criteria
-
GET /modelsreturns only allowed models; a model outside the list cannot be set (a test). -
POST …/modelandPOST …/effortwrite the registers the TUI writes, and a latertole resumeof the session sends them (a test next tosession_model_e2eandsession_effort_e2e). -
409while a turn runs,404for an unknown session,401without the token,400for an invalid value; each has a test. -
docs/mobile-control.mdand the CHANGELOG are updated in the same PR.
Activity