The terminal UI needs a discoverable model switch path that stays scriptable.
The default interactive path is a command-shaped autocomplete popup in the
composer; explicit /model <target> commands remain the only execution
contract.
/model or /model in the composer opens a model popup above the
input area./model show the current session model and
configured selectable models as text./model list is the explicit list form./model main switches to model.main./model lite switches to model.lite when it is configured./model <provider/model> switches to a configured selectable model with that exact id.model.main, optional model.lite, and every model declared under every configured provider.*.models./model <provider/model>
through the normal command center path./model <provider/model> without
submitting, matching the existing slash command autocomplete behavior.TUI 不拥有选型状态,只渲染 Bootstrap 的每会话 cliDefaultSelection。CLI 装配显式使用
modelSelectionMode: "cli-default";/model 和 /effort 修改并持久化下一条用户消息的默认选择,
不提前改变 Core Session Selection。CLI 用户消息在入口补齐 Selection,实际接受后成为 Session
续跑选择。App/Bot 的现有显式配置入口不因 CLI 装配改变语义。
新 CLI 会话从 Provider Config 的 config.defaultModelSelection 初始化默认值,恢复会话读现有
runtime/model_selection entry。全局保存继续复用现有命令路径,不引入新配置文件或迁移。
后台唤起和 Goal 直接使用 Session Selection;不会从 CLI 默认值补模型。闲时临时选择不写普通用户 entry。
Draft(deferred)会话在首条输入前还没有 session 行。此时 /model、/effort 及 App 的选型/档位命令
仍立即在内存生效,但写 runtime/model_selection entry 会因外键约束失败;这是已知时序,
不是持久化故障:首条输入或外部活动持久化会话时,runtime 以当时的 Session Selection 统一写入同一稳定 entry。
因此只有 runtime.isSessionPersisted() 仍为 false 时,这次写入失败记 debug
(session.model_selection.persist_deferred);会话已持久化后的写入失败仍记 warn
(session.model_selection.persist_failed)。写入仍先尝试,不按“未持久化就跳过”处理,
避免与进行中的首次持久化竞态而漏写较新的选择。
The TUI sends /model ... through the same submit callback as other slash commands. The command center asks the app/server for current model state, available model options, and applies the selected model through an explicit app-level method. The TUI renders the returned command text and updates its session metadata projection from the returned model and thoughtLevel fields.
For composer autocomplete, the CLI passes a read-only list of selectable models
into TUI options. The TUI may recognize the draft shape /model... only to
filter and render local suggestions. It owns only the popup filter, highlighted
index, and completion behavior; it does not cache model catalog state or apply
model switches directly.
Run section renders Provider and Model as separate rows./, matching the runtime provider/model contract where model
ids may themselves contain /.Provider row renders
- and the Model row renders the bare id.model_selected session event with modelRef.providerId and
modelRef.modelId refreshes the same display projection as a /model command
result. The TUI still does not store provider and model as authoritative state./model. It receives optional initialModel,
initialThoughtLevel, and read-only model options from the CLI bootstrap path
before the first render and later updates active model display only from
TuiSubmitPromptResult or live model request events./model and dispatches to the app-level model contract.model.available runtime catalog. It must preserve provider connection fields so switching to a model from another provider can run without TUI state.getModel, getThoughtLevel, listModels, and setModel
as narrow server-side APIs.ModelRef through AgentRuntime.updateConfig({ modelRef, modelProviderOptions }).modelProviderOptions from the configured main
model target, or from the catalog default thought level when the target does
not declare explicit options, so the first turn and first render reflect the
same model provider settings as later /model switches./model returns a command response.model.lite is not configured, /model lite reports the available model ids and aliases./model or /model list reports the condition in text.provider/ separator; command parsing must not lowercase full model refs./model.submitPrompt./model to the app/server contract./model <id>, Tab completion into the draft, and Esc dismissal.provider/model renders as separate Provider
and Model rows, including model ids that contain /.model_selected payloads with providerId and
modelId update the current model projection.model.available.setModel update runtime modelRef and clear/replace
modelProviderOptions, including catalog default thought provider options
when a model has selectable reasoning but no explicit target options.npm run lint and npm test pass before completion.