Provider Refactor 已将正式模型事实收口为
properties.input_format/properties.output_format。本文保留 staging UI 决策和历史实施记录; 当前数据契约以../../working-memory/provider-refactor/design/model/input-output-format.md为准。
ModelProviderModelConfig.modalities 支持 input / output,公共枚举为 text、image、video、audio、pdf;模型编辑弹窗提供 Text/Image/Video 输入类型和固定 Text 输出类型入口。docs/superpowers/specs/2026-06-04-model-provider-model-editor-design.mddocs/model-provider-client-config-remote-model-facts.mddocs/superpowers/plans/2026-06-24-model-media-capability-projection.mddocs/ssh-remote-app-global-state-authority.md在模型供应商设置的“添加模型”和“编辑模型配置”弹窗内增加类型选择交互,使用户可以声明模型支持的输入、输出类型。底层继续使用 provider schema 的 modalities 字段;保存后的类型事实必须进入现有 provider registry,并在当前运行时已经支持的能力边界内生效。
本功能不是单纯展示字段。用户显式取消图片或 PDF 输入时,配置必须能与旧版“未声明能力”区分,避免 UI 显示 text-only、运行时却仍按未知能力透传媒体。PDF 使用现有底层能力事实,并在设置页提供独立切换入口。
~/.zcode/v2 成为模型设置权威源。ModelProviderModelConfig.modalities 当前总会被归一化为数组;未配置时缺省为:
{
"input": ["text"],
"output": ["text"]
}
但对 legacy/custom provider,这个 text-only 缺省并不代表“明确不支持图片”。convertModelProviderConfigToZCodeProviderInput 会保留媒体能力未知态,防止第三方 vision 模型因为历史默认值被误判为 text-only。
因此下面两种状态当前在内存配置中不可区分:
旧配置没有 modalities ──归一化──> input=[text] ──> 能力未知,允许媒体透传
用户明确只选 text ─────归一化──> input=[text] ──> 期望明确不支持 image/pdf
只增加 UI 和数组保存会产生错误交互:取消 image 后,运行时仍可能继续发送 image。3.9.0 必须同时保留“模态是否由用户显式配置”的来源事实。
mb-1 垂直间距,不能让分组容器的 space-y-3 放大模型能力标题下方留白。w-24 稳定操作列,标签与 Switch 在该列内水平居中。窄屏继续保持同一行,模型 ID 列允许收缩,不能把 Switch 挤出弹窗。px-3 py-2 内边距;拖拽中的浮起项不显示行底部分隔线,使用透明底边框保留原始占位尺寸,避免拖动时产生纵向抖动。SettingsFormActions 层级:恢复默认留在左侧;右侧“保存”在前并使用 default + lg,“取消”在后并使用 ghost + lg。窄屏允许上下排列,但不能改变主次关系或丢失操作。rounded-xl 圆角和中性浮层,不使用整块绿色背景、绿色边框或绿色正文;仅成功图标保留 text-success 语义。失败反馈继续保留高辨识度的 destructive 样式。1000000128000outline + lg 外壳,固定 h-8(32px)、rounded-lg 和左右 12px(px-3)内边距;内部使用 size-4 模态图标与文本,不展示 checkbox。选中态使用 bg-selected border-primary/20,并以 background-clip: border-box 覆盖共享 Button 的 padding-box 裁剪,使半透明状态边框实际叠加在选中背景上;Hover 只增强为 border-border-hover,选中项 Hover 时继续保持 bg-selected;未选中态使用 bg-transparent border-border。Personal Overlay 不覆盖模态选项的状态边框。Text 保持选中并通过原生 disabled 禁止点击,在选项末尾展示弱化的锁图标以表达不可取消;其余选项点击或按 Space 切换。bg-selected border-primary/20,未选中态使用 bg-transparent border-border,Hover 只将边框增强为 border-border-hover,选中 Hover 保持 bg-selected。控件继续保留 role="checkbox" 与 aria-checked,确保键盘交互和辅助技术可以读取选择状态。Personal Overlay 不改变这套状态颜色。text-ui-sm 普通 UI 字体,不使用等宽字体。编辑输入按内容宽度伸缩并沿用档位的 h-7 外壳,进入编辑态时字号、高度和宽度不得突跳;新增入口使用与档位同高的 size-7 Outline 图标按钮,保留紧凑方形边框。128000。输出模态按 3.9.0 产品边界固定为 Text。["text"];只读的 catalog/远端权威模型保持服务端原始 output 事实,不参与这次归一化。maxOutputTokens 时,只能在用户尚未手动编辑该字段时覆盖 128000;未命中、未声明、查询失败或迟到结果均保留当前值,不再清空为无默认值。supportsVideo 能力投影参与对话附件校验;不支持 Video 编码的 provider adapter 仍在运行时拒绝或降级,不能只凭设置页勾选绕过。推荐给 ModelProviderModelConfig 增加可选来源字段,例如:
modalitiesConfigured?: boolean;
语义:
true:用户或权威 catalog 明确提供了模态事实;input 中缺少 image/pdf 可以投影为显式 false。undefined:历史 custom/legacy 配置没有可靠模态事实;即使归一化数组是 text-only,也继续保持媒体能力未知。字段需要通过 zcode 扩展保存,避免污染 OpenCode 公共字段;顶层 modalities 继续保存真实 input/output 数组。命名可在实现前调整,但必须保留同等的来源区分,不能复用粗粒度的 modified:用户只修改 context window 时不应被误判为显式 text-only。
草稿需要单独跟踪模态是否被用户触碰。打开旧模型后只修改 context window,不得自动写入 modalitiesConfigured=true;只有用户改变模态,或新增模型时主动确认模态选择,才写入显式来源。
modalities.input 包含任意非 text 类型时,UI 将该模型标记为视觉模型。该判定只消费模型已经声明的输入类型,不依赖 modalitiesConfigured、输出类型、provider adapter 或附件编码能力。rounded-md、语义边框/表面色和紧凑字号样式;上下文窗口继续使用等宽字体,视觉文案使用普通 UI 字体。Vision,不得在任一入口回退为中文或使用不同英文名称。openrouter/ox-alpha、openrouter/nvidia/model 等包含一个或多个 / 的 ID 必须原样展示、编码和选择,不得为了标识投影按 / 拆分或反向匹配。模型设置弹窗
local draft
├─ inputModalities
├─ outputModalities=[text]
└─ modalitiesTouched
|
| 保存 + 校验
v
本地 modelProviderService(唯一权威)
~/.zcode/v2/config.json
├─ model.modalities.input/output
└─ model.zcode.modalitiesConfigured
|
| provider registry revision
+-------------------------------+
| |
v v
桌面本地 runtime desktop-attached 远端 runtime
workspace/updateProviderRegistry 本地快照显式下发,不写远端配置
| |
+---------------+---------------+
v
协议模型能力投影
catalog-backed 或 modalitiesConfigured=true
├─ input 包含 image -> supportsImages=true
├─ input 不含 image -> supportsImages=false
├─ input 包含 pdf -> supportsPdf=true
├─ input 不含 pdf -> supportsPdf=false
├─ input 包含 video -> supportsVideo=true
└─ input 不含 video -> supportsVideo=false
legacy custom 且未显式配置
└─ 不下发 supportsImages/supportsPdf/supportsVideo,保持 unknown
|
v
当前 session 热更新 modelInputMediaCapabilities
|
v
provider-visible request 媒体保留或文本化
workspaceIdentity?.trim() || workspacePath 隔离同步状态,并携带 remoteSessionId;workspacePath 只用于执行和展示。/remote 仍附着桌面已有 host;不新增独立 runtime,也不把模态设置写入 replayable snapshot。clientMode / deliveryKind,必须用回归用例证明 desktop continuous 与 web remote replayable 均未被改变。| 场景 | UI 入口 | 草稿 owner | 默认/回显 | 校验 | commit sink | 权威落点 | 边界 |
|---|---|---|---|---|---|---|---|
| 添加自定义模型 | ProviderModelsSection -> ProviderModelMetadataDialog |
add draft state | context=1M、maxOutput=128K、input/output=Text | ID 必填、数字为正整数、Text input 锁定 | onAddModel |
本地 provider config | 新模型显式保存类型 |
| 编辑自定义模型 | ModelRowInput -> ProviderModelMetadataDialog |
row draft state | 已保存 input + 固定 Text output | Text input 不可取消 | onModelCommit |
本地 provider config | 未触碰输入模态不得改变 unknown 语义 |
| 内置/套餐模型 | provider settings read-only row | 无可编辑草稿 | catalog/remote facts | 服务端 schema | 不提交 | 本地权威同步缓存 | 不允许本地覆盖权威事实 |
| 对话模型运行时 | 无新增 UI | 当前 session runtime config | provider registry projection | existing capability guard | registry hot update | Agent runtime memory | 消费 image/pdf/video input |
共享模型选择器、自动化、Subagent、Repo Wiki 只读取 provider registry 候选,并在候选模型声明任意非 Text 输入类型时展示“视觉 / Vision”标识。本次不改变它们的 draft、default 或 commit sink;需要做候选与默认隔离回归,但不新增模态编辑入口。
ProviderModelDraftValues 增加 input 模态数组和 modalitiesTouched(或等价局部状态);output 在可编辑模型提交时固定为 ["text"]。supportsVideo;Audio/输出类型不得被错误映射到 supportsImages / supportsPdf / supportsVideo。supportsImages、supportsPdf、supportsVideo。Audio 若要立即生效,必须先扩展协议 schema 和 runtime 能力,该要求不属于本 spec。text-ui-* 与语义色 token。/)仍作为完整值参与选择,只有可见文本可以按现有布局截断。feature graph 已补充 capability.model-capabilities 到共享模型候选和 provider settings 的视觉标识投影关系;既有 surface.provider-settings -> capability.provider-registry 显式模态来源关系保持不变。
/ 的模型 ID round-trip。zcode 来源标记 round-trip、legacy migration。