Model Switch
September 1, 2026 · View on GitHub
Model Switch is a coordinated plugin-only DSH product for explicit model routing. Product, package, bundle, and settings-page identity remain Model Switch / dsh-model-switch. It may replace independently packaged DSH modules through name-matched public disable-and-insert patches and may extend self-maintained provider plugins, but never edits DSH Core, official package files, or production during acceptance.
Routes
- Default Main: provider, model, and optional effort. It uses the public Settings namespace and is copied only into newly created sessions; existing sessions are never migrated or selected through the session picker.
- Default Subagent:
follow-mainor a fixed provider/model/effort. Follow-main resolves the immediate parent's latest request header, then global Main, and injects the route before official descriptor creation. Local spawn, fork, continuable, and workflow children use this policy unless workflow explicitly supplies provider/model. DSH 0.1.2-alpha.1 carries the fixed route, including effort, in childAgentOptions. Remote Codex/Claude children are outside unified routing. - Search Router: does not register or replace
web_search. Model Switch registers one publicWebSearchProviderwith idmodel-switch; the existing officialweb_searchcontinues throughctx.web, whose configured search provider must bemodel-switch. The thin provider selects the configured backend adapter and model at execution time and returns the officialWebSearchResultunchanged. v0.2.0 supports Codex Search only.web_fetchand its configured provider remain unchanged. - Vision: excluded. Model Switch exposes no Vision setting, does not shadow
read_image, and does not preprocess chat attachments. - Image Router: owns a new, uniquely named stable
generate_imagetool. It selects the configured Codex or Grok adapter/model at execution time, rejects backend-incompatible fields, and returns normalized image metadata. Existing provider-specific image tools remain available as rollback paths. - Composer Picker: replaces the composer model seat with a suffix-grouped Model / Effort / Context / Fast / Thinking picker and submits through the official Model Directory. Variant changes preserve an effort only when the target catalog row supports it, otherwise they use the target default or omit effort. Picker changes are session-local. On a Host version that also persists session selection as the deployment default, the plugin restores the pre-switch Main default through the public Settings RPC with a revision fence; a concurrent Settings-page edit wins.
- Plan Review: intercepts the official
plan-reviewcomposer takeover with a header execution-model picker and right-aligned Discuss in chat / Reject / Confirm actions. Confirm commits the selected model before answering.
Model choices are capability-driven. Invalid, unavailable, or unsupported selections remain visible to configuration surfaces and fail loudly at use; routing never silently falls back.
Preset modes
Official agent-presets stay in the process. A nested ctx.plugin(AgentPresets) from this package would load a second @deepseek-ai/dsh-scope identity, so session.create fails with an unscoped-context refusal. Preset delegation tools already resolve the replacement subagents service after the Subagent Loader row is replaced. Model Switch ships no preset roots and leaves the official presets unchanged.
Settings and lifecycle
The settings surface aggregates public Settings namespaces, reads and mutates with optimistic revisions, and saves rows independently. Changing a Main or fixed Subagent model applies only the target catalog row's default effort, so an effort never leaks across providers or models. Every registration, watcher, and dynamic tool generation has clean disposal. All visible copy lives in zh/en locale dictionaries.
Exclusions
No compaction, title, fetch routing, fallback, load balancing, provider credentials, CLI/API, configuration history, or DSH Core edits. Coordinated changes are limited to Model Switch and self-maintained provider plugins. Installing this package replaces a standalone dsh-composer-picker install; keep only one composer model seat.
Official settings.section has no icon field. The Settings nav glyph is a label-matched DOM swap, the same published pattern as usage-monitor, until an official icon seam exists. The Plan Review takeover uses priority -5, and the composer model seat uses priority -10.
Delivery architecture
The package foundation and pure deep modules remain the policy/test surface. Runtime delivery disables the independent Subagent Loader row with its official name and inserts a uniquely identified replacement. Official AgentPresets stay mounted so they share the process dsh-scope identity. Search uses the released ctx.web.registerSearchProvider() seam so official tool ownership is preserved. Image uses a unique tool name and provider-owned authenticated adapters. Self-maintained Codex/Grok plugins register optional adapters through the public Model Switch service when present; standalone provider behavior is unchanged. Vision remains disabled. Replacement modules preserve the official public interfaces and fail closed when compatibility or capability validation fails.