feat(vscode): add opencode model effort toggle#108
Open
zeug-zz wants to merge 2 commits into
Open
Conversation
Adds optional explicit model effort/variant selection for reasoning-capable
models in the OpenCode chat webview, matching the opencode TUI Ctrl+T flow.
Core:
- Add optional effort (ModelVariantRef) to ModelRef-adjacent types:
ModelInfo.variants, SendMessageOptions.effort, and UIToHostMessage
sendMessage / editAndResend.
- Add helper getModelVariants / isModelVariantSupported /
validateModelVariant with 27 unit tests covering unsupported metadata,
disabled variants, and model-change invalidation.
- Add vitest setup for @opencodegui/core.
Agent (opencode):
- sendMessage forwards options.effort.id as top-level variant on
client.session.promptAsync (sibling of model). Default payloads omit
the key entirely so the server applies its own default.
- executeShell is intentionally unchanged: SDK 1.2.17 shell body has no
variant field.
Webview:
- useProviders tracks selectedModelEffort, validates on model change,
and clears when the new model does not advertise the prior id.
- ModelSelector displays effort (label or id) compactly next to the
model name; no separator/text when unset.
- InputArea handles Ctrl+T (textarea only, no meta/alt modifiers) to
cycle valid variants from ModelInfo.variants; no preventDefault when
the model is unsupported or no setter is wired.
- App forwards effort in sendMessage / editAndResend payloads only when
selected; executeShell payload remains { sessionId, command, model }.
Host:
- chat-view-provider forwards message.effort into IAgent.sendMessage
options for send and edit-resend; never for executeShell.
OpenSpec: archived change `2026-06-11-add-model-effort-toggle` and added
spec `model-effort-control`.
6fad683 to
d4cc887
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds optional explicit model effort/variant selection for reasoning-capable models in the OpenCode chat webview, matching the opencode TUI
Ctrl+Tflow. When the selected model advertises variants (e.g. low / medium / high), the user can cycle through them withCtrl+Tin the textarea; the chosen effort is forwarded onsendMessageandeditAndResendpayloads only when explicitly set — omitting the field entirely when unset so the server applies its own default.What changes
@opencodegui/core): add optionalModelVariantReftoModelInfo.variants,SendMessageOptions.effort, andUIToHostMessagesendMessage/editAndResend. New helpersgetModelVariants,isModelVariantSupported,validateModelVariantwith 27 unit tests covering unsupported metadata, disabled variants, and model-change invalidation. Add vitest config for the core package.sendMessageforwardsoptions.effort.idas a top-levelvariantonclient.session.promptAsync(sibling ofmodel). Default payloads omit the key entirely.executeShellis intentionally unchanged — SDK 1.2.17 shell body has novariantfield.useProviderstracksselectedModelEffort, validates on model change, and clears when the new model does not advertise the prior id.ModelSelectordisplays effort (label or id) compactly next to the model name with a middle-dot separator; hidden when unset.InputAreahandlesCtrl+T(textarea only, no meta/alt modifiers) to cycle valid variants;preventDefaultfires only when a cycle action is performed.effortinsendMessage/editAndResendpayloads only when selected;executeShellpayload remains{ sessionId, command, model }.chat-view-providerforwardsmessage.effortintoIAgent.sendMessageoptions for send and edit-resend; never forexecuteShell.Impact
26-effort-cycle.test.tsx+ expanded coverage in messaging, editing, shell, model-selection, useProviders, and ModelSelector tests)pnpm checkintroduces no new warnings in the touched filesexecuteShellintentionally omits effort — SDK 1.2.17 has no variant field on the shell body