@@ -3,6 +3,7 @@ import type { Auth } from "@opencode-ai/sdk/v2";
33import type { McpServerConfig } from "@cursor/sdk" ;
44import { resolveCursorApiKey } from "../api-key.js" ;
55import { discoverModels , toOpencodeModels } from "../model-discovery.js" ;
6+ import { defaultModelParams } from "../model-variants.js" ;
67import { buildModelV2Map , PROVIDER_ID , providerNpm } from "./model-v2.js" ;
78import {
89 findUnshareableOAuthServers ,
@@ -117,6 +118,17 @@ export const CursorPlugin: Plugin = async (input) => {
117118 ? { ...userMcp , ...translateMcpServers ( config . mcp ) }
118119 : userMcp ;
119120
121+ // opencode forwards a model's own options.params on the normal chat
122+ // path, but a subagent inheriting its parent's model reaches the provider
123+ // with them dropped — letting Cursor's server-side `fast: true` apply.
124+ // Thread the defaults through provider options (per-provider, survives
125+ // the drop) so the provider can re-apply them as a floor.
126+ const modelParamDefaults : Record < string , Record < string , string > > = { } ;
127+ for ( const item of models ) {
128+ const params = defaultModelParams ( item ) ;
129+ if ( Object . keys ( params ) . length > 0 ) modelParamDefaults [ item . id ] = params ;
130+ }
131+
120132 // One canonical cwd for the provider's rule write and our dispose
121133 // cleanup: an explicit user option wins, else the plugin directory.
122134 const optionCwd = existingOptions [ "cwd" ] ;
@@ -133,6 +145,9 @@ export const CursorPlugin: Plugin = async (input) => {
133145 ...existingOptions ,
134146 cwd : resolvedCwd ,
135147 ...( Object . keys ( mcpServers ) . length > 0 ? { mcpServers } : { } ) ,
148+ ...( Object . keys ( modelParamDefaults ) . length > 0
149+ ? { modelParamDefaults }
150+ : { } ) ,
136151 } ,
137152 models : { ...toOpencodeModels ( models ) , ...( existing . models ?? { } ) } ,
138153 } ;
0 commit comments