Skip to content

feat(vscode): add opencode model effort toggle#108

Open
zeug-zz wants to merge 2 commits into
ktmage:developmentfrom
zeug-zz:feat/model-effort-toggle
Open

feat(vscode): add opencode model effort toggle#108
zeug-zz wants to merge 2 commits into
ktmage:developmentfrom
zeug-zz:feat/model-effort-toggle

Conversation

@zeug-zz

@zeug-zz zeug-zz commented Jun 11, 2026

Copy link
Copy Markdown

Adds optional explicit model effort/variant selection for reasoning-capable models in the OpenCode chat webview, matching the opencode TUI Ctrl+T flow. When the selected model advertises variants (e.g. low / medium / high), the user can cycle through them with Ctrl+T in the textarea; the chosen effort is forwarded on sendMessage and editAndResend payloads only when explicitly set — omitting the field entirely when unset so the server applies its own default.

What changes

  • Core (@opencodegui/core): add optional ModelVariantRef to ModelInfo.variants, SendMessageOptions.effort, and UIToHostMessage sendMessage / editAndResend. New helpers getModelVariants, isModelVariantSupported, validateModelVariant with 27 unit tests covering unsupported metadata, disabled variants, and model-change invalidation. Add vitest config for the core package.
  • Agent (opencode): sendMessage forwards options.effort.id as a top-level variant on client.session.promptAsync (sibling of model). Default payloads omit the key entirely. 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 with a middle-dot separator; hidden when unset. InputArea handles Ctrl+T (textarea only, no meta/alt modifiers) to cycle valid variants; preventDefault fires only when a cycle action is performed.
  • 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.
  • Locales updated: en, es, ja, ko, pt-br, ru, zh-cn, zh-tw.

Impact

  • 28 files changed, +2697 / −34
  • Tests: 1720/1720 pass (27 new core tests + new scenario 26-effort-cycle.test.tsx + expanded coverage in messaging, editing, shell, model-selection, useProviders, and ModelSelector tests)
  • pnpm check introduces no new warnings in the touched files
  • No new runtime dependencies
  • No breaking changes to existing model selection, message sending, shell execution, or Markdown rendering
  • executeShell intentionally omits effort — SDK 1.2.17 has no variant field on the shell body

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`.
@zeug-zz zeug-zz force-pushed the feat/model-effort-toggle branch from 6fad683 to d4cc887 Compare June 14, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant