diff --git a/packages/cursor/README.md b/packages/cursor/README.md index 258544f..f65517e 100644 --- a/packages/cursor/README.md +++ b/packages/cursor/README.md @@ -210,7 +210,10 @@ minutes), the way pi-cursor-sdk lists Cursor's catalog: them), fast the request's `service_tier`. - An id for a model with thinking that the account lists only without it (`claude-haiku-5-5-thinking` when the list has Claude Haiku 5.5 alone), - or the other way round, runs as the model the account has. + or the other way round, runs as the model the account has. So does a + picker model whose default thinks while the account lists it only + without thinking (`claude-haiku-5-5`), or the other way round: each of + its variant ids goes as the id the account lists. - An `@` id the list no longer has (`claude-opus-5-5@1m` when only 300k is listed, or the model is listed unsized) runs at the model's nearest size, in Max Mode when the size asked for is over the model's diff --git a/packages/cursor/context.test.mjs b/packages/cursor/context.test.mjs index f8cffd2..d063c75 100644 --- a/packages/cursor/context.test.mjs +++ b/packages/cursor/context.test.mjs @@ -440,3 +440,19 @@ test("a picker model with thinking variants only takes an id 0.1.x listed withou const raw = await usable(tok()) expect(request(raw, "claude-haiku-5-5-low", "", undefined).id).toBe("claude-haiku-5-5-thinking-low") }) + +// ysm119 on Discord again, after 0.2.25: claude-haiku-5-5-thinking still +// failed its test. A Team account's picker can have Claude Haiku 5.5, its +// default with thinking, while cursor-agent models lists Haiku under one id +// of another family (claude-haiku-5-5, no thinking). The entry's family was +// its default's alone, which the account hasn't got, so every Haiku id went +// out as a picker variant Cursor answers "AI Model Not Found". +test("a picker model whose usable id is of its other family, with or without thinking, goes as that id", async () => { + const opus = OPUS55_USABLE.filter((m) => /-(medium|high)(-fast)?$/.test(m.modelId)) + for (const haiku of [["claude-haiku-5-5"], ["claude-haiku-5-5-thinking"], ["claude-haiku-5-5-low", "claude-haiku-5-5-high"], ["claude-haiku-5-5-thinking-low"]]) { + fakeAPI(PICKER, [...opus, ...REST_USABLE, ...haiku]) + const raw = await usable(tok()) + for (const id of ["claude-haiku-5-5-thinking", "claude-haiku-5-5", "claude-haiku-5-5@300k", "claude-haiku-5-5@1m", "claude-haiku-5-5-thinking-high", "claude-haiku-5-5-low", "claude-haiku-5-5-thinking-low"]) + for (const effort of ["", "none", "low", "medium", "high", "max"]) expect([haiku, id, effort, haiku.includes(request(raw, id, effort, undefined).id)]).toEqual([haiku, id, effort, true]) + } +}) diff --git a/packages/cursor/index.mjs b/packages/cursor/index.mjs index 85aef63..7e2372c 100644 --- a/packages/cursor/index.mjs +++ b/packages/cursor/index.mjs @@ -827,7 +827,14 @@ function modelsOf(picker, ids, listed = []) { const def = defaultVariant({ variants }) const { pid, levels: all } = effortsOf(defs) const levels = Object.fromEntries(Object.entries(all).filter(([, value]) => has(pid, value))) - const fam = fams.get(familyOf(def?.legacySlug || m.name).family) ?? [] + // the usable ids of its default's family, else of the same model with + // thinking or without it: a Team's picker can default Claude Haiku 5.5 + // to thinking while cursor-agent lists it as claude-haiku-5-5 alone + // (ysm119 on Discord, after 0.2.25), and a variant id it lacks is then + // asked as that one, as named() takes such an id + const own = familyOf(def?.legacySlug || m.name).family + const bare = own.replace(/-thinking$/, "") + const fam = fams.get(own) ?? fams.get(bare) ?? fams.get(bare + "-thinking") ?? [] const base = { run: m.name, title: clean(m.clientDisplayName || m.name), pid, levels, fast: !!defs.fast?.length, variants, def, partial, model: m, fam, ids } const contexts = (defs.context ?? []).filter((c) => has("context", c)) if (contexts.length) { diff --git a/packages/cursor/package.json b/packages/cursor/package.json index 52d3027..a715069 100644 --- a/packages/cursor/package.json +++ b/packages/cursor/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-cursor-auth", - "version": "0.2.25", + "version": "0.2.26", "description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to", "type": "module", "main": "./index.mjs",