Skip to content

Commit 7753329

Browse files
committed
style: trim redundant comments on subagent param floor
Collapse the repeated subagent/fast rationale to a single home (the plugin config hook where the map originates); reduce the type-field docstrings to one-liners and drop the self-evident debug-log comment.
1 parent 681b83f commit 7753329

4 files changed

Lines changed: 13 additions & 30 deletions

File tree

src/plugin/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,11 @@ export const CursorPlugin: Plugin = async (input) => {
118118
? { ...userMcp, ...translateMcpServers(config.mcp) }
119119
: userMcp;
120120

121-
// Per-model floor params (e.g. { "composer-2.5": { fast: "false" } }).
122-
// opencode merges each model's own `options.params` on the normal chat
123-
// path, but a subagent that inherits its parent agent's model can reach
124-
// the provider with the bare model id and no params. Threading these
125-
// defaults through the (per-provider, not per-request) provider options
126-
// lets the provider re-apply them as a floor so `fast` never silently
127-
// falls back to Cursor's server-side `true`.
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.
128126
const modelParamDefaults: Record<string, Record<string, string>> = {};
129127
for (const item of models) {
130128
const params = defaultModelParams(item);

src/provider/controls.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ export interface StaticControls {
66
/** Default Cursor model params (id -> value), e.g. { thinking: "high" }. */
77
params?: Record<string, string>;
88
/**
9-
* Per-model floor params applied UNDER {@link params} and per-request options.
10-
* Carries this model's non-reasoning boolean defaults (e.g. `{ fast: "false" }`)
11-
* so a call that reaches the provider with the bare model id and no params —
12-
* notably an opencode subagent inheriting its parent's model — still pins
13-
* `fast` off instead of inheriting Cursor's server-side `fast: true` default.
14-
* The normal chat path already carries these via the model's opencode
15-
* `options.params`, so re-applying them here is a no-op there.
9+
* Per-model floor params, applied UNDER {@link params} and per-request options
10+
* (an explicit param always wins). Pins Cursor's boolean toggles, e.g.
11+
* `{ fast: "false" }`, when a turn arrives with no params of its own.
1612
*/
1713
defaults?: Record<string, string>;
1814
}

src/provider/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ export interface CursorProviderOptions {
3434
/** Default Cursor model params (id -> value), e.g. { thinking: "high" }. */
3535
params?: Record<string, string>;
3636
/**
37-
* Per-model floor params keyed by model id (e.g. `{ "composer-2.5": { fast:
38-
* "false" } }`). Seeded by the plugin's `config` hook from the discovered
39-
* catalog so subagents that inherit a model without its options.params still
40-
* pin Cursor's boolean toggles to their opencode defaults. Applied under
41-
* `params` and per-request options.
37+
* Per-model floor params keyed by model id, e.g. `{ "composer-2.5": { fast:
38+
* "false" } }`. Seeded by the plugin's `config` hook; applied under `params`
39+
* and per-request options.
4240
*/
4341
modelParamDefaults?: Record<string, Record<string, string>>;
4442
/**

src/provider/language-model.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,8 @@ export interface CursorModelConfig {
5656
/** Default Cursor model params (id -> value); overridable per-request. */
5757
params?: Record<string, string>;
5858
/**
59-
* Per-model floor params keyed by model id (e.g. `{ "composer-2.5": { fast:
60-
* "false" } }`). Applied under {@link params} and per-request options so a
61-
* call arriving with the bare model id and no params — notably an opencode
62-
* subagent that inherited its parent agent's model — still pins Cursor's
63-
* boolean toggles (like `fast`) to their opencode defaults instead of
64-
* silently inheriting Cursor's server-side `fast: true`. Seeded by the
65-
* plugin's `config` hook from the discovered catalog.
59+
* Per-model floor params keyed by model id, seeded by the plugin's `config`
60+
* hook. Passed as {@link resolveControls}'s `defaults` for the active model.
6661
*/
6762
modelParamDefaults?: Record<string, Record<string, string>>;
6863
/** MCP servers forwarded to the Cursor agent from opencode's config. */
@@ -158,10 +153,6 @@ export class CursorLanguageModel implements LanguageModelV3 {
158153
providerOptions,
159154
);
160155
if (process.env["OPENCODE_CURSOR_DEBUG"] === "1") {
161-
// Root-cause instrument: shows the exact ModelSelection sent to Cursor.
162-
// A subagent that inherited its parent's model with dropped params shows
163-
// up here as a selection missing the `fast: "false"` floor before the
164-
// modelParamDefaults guard re-applies it.
165156
console.error(
166157
`[cursor:debug] model=${this.modelId} selection=${JSON.stringify(modelSelection)}`,
167158
);

0 commit comments

Comments
 (0)