feat: per-axis Cursor model-state selector (effort/thinking/fast/context)#67
Open
justin-carper wants to merge 13 commits into
Open
feat: per-axis Cursor model-state selector (effort/thinking/fast/context)#67justin-carper wants to merge 13 commits into
justin-carper wants to merge 13 commits into
Conversation
…atomic bridge write
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.
What
Adds a per-axis Cursor model-state selector to the plugin. Cursor models expose several independent state axes — effort/reasoning level, thinking on/off, fast on/off, context window — which the catalog pre-enumerates as a full cartesian
variants[](e.g.claude-opus-4-8has 40 variants). A flat 40-entry cycler is unusable, so this feature lets the user cycle each axis independently via hotkeys, with a live status widget and per-session persistence.Why
The plugin previously surfaced only a subset of states (effort + fast) folded into one cycler. Thinking, context, Max-mode (effort
max), and per-axis composition were unreachable. This delivers the full state matrix through an efficient per-axis UI instead of an unusable flat list.How
Two-target plugin package:
./server(existing Hooks) — unchanged behavior.chat.paramsgains an additive read+merge of the composed selection../tui(newTuiPlugin) — registers per-axis cycle hotkeys, a live status widget in thesession_prompt_rightslot, and persists the composed selection.Pure, unit-tested core:
src/model-axes.ts—buildModelAxesderives independent axes fromitem.variants[];isValidCombo/snapCombohandle asymmetric models (e.g.gpt-5.5only offersfastatcontext=272k).src/tui/axis-state.ts—seedSelection,cycleAxis(immutable, wraps),formatSelection,reconcileSelection.Cross-half bridge: opencode exposes no client API for persistent session model options and no cross-half KV endpoint, so the two plugin halves share state through a file both compute identically:
src/tui/state-file.tswrites<cacheDir>/cursor-states.jsonkeyed bysessionID(atomic temp+rename); the serverchat.paramshook reads it and merges string-only params intooutput.options.params.src/provider/controls.ts(the Cursor wire-shaping path) is unchanged.Default hotkeys (overridable in
tui.json):ctrl+eeffort/reasoning,ctrl+tthinking,ctrl+ffast,ctrl+kcontext;shift+<key>= previous. A toast shows each new value; the widget shows the composite (high · think · fast · 1m).--pure/ no-TUI fallback:buildModelVariantsstill feeds opencode's nativevariant_cycle, now re-sourced from axes as a curated, non-cartesian short list (one entry per non-default axis value — never 40).Requirements
engines.opencode) — first version shipping the TUI plugin API.@opentui/core,@opentui/solid,solid-jsare optional peer dependencies (host-provided at runtime,externalin the build) so server-only /--pureinstalls are unaffected.Testing
npm test— 324 passing across 30 files (newmodel-axes,axis-state,state-filesuites; updatedmodel-variants,model-v2,model-discovery).npm run buildandnpm run typecheckclean.test/fixtures/cursor-catalog.json), covering the 40-variant, asymmetric, toggle-only, and no-axis shapes.Manual smoke (requires a real opencode >= 1.17.0 runtime — not automatable here)
npm pack, install the tarball's./tuiin a scratchtui.jsonpluginarray and the./serverhalf as the provider plugin.cursor/claude-opus-4-8and send one message (an assistant message is how the TUI half detects the active Cursor model).ctrl+e→ toast showsEffort: <next>, widget updates.shift+ctrl+ereverses.ctrl+t/ctrl+f/ctrl+k→ thinking / fast / context change; widget reflects the composite.cursor/gemini-3.1-pro→ no axes; hotkeys inert; widget shows model name only.<cacheDir>/cursor-states.jsoncontains{ "<sessionID>": { ...selection } }.params.Known v1 limitations
--purefallback + default-ON toggles. A toggle that defaults ON (e.g.composer-2.5'sfast) produces no curated fallback entry for that axis. The TUI cycler covers the full range; only the deprioritized--purelist is affected.