@magpie-community/opencode-cursor-auth 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/index.mjs +14 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -87,7 +87,9 @@ minutes), the way pi-cursor-sdk lists Cursor's catalog:
87
87
  sent as the model's effort parameter. `none` turns a Claude's thinking off.
88
88
  - Fast is not a model of its own either: a `service_tier` of `priority`
89
89
  or `fast` sends `fast=true`, anything else `fast=false` (it costs more,
90
- so only when asked).
90
+ so only when asked). A model listed at a size Cursor has a fast variant
91
+ of (served to the account) says `fast: true`, which magpie offers its
92
+ Fast switch for (yetone/magpie#1360).
91
93
  - A request goes as the picker's variant those parameters pick, in Max Mode
92
94
  when that variant is Max Mode's (a 1M size, say), as the CLI turns it on.
93
95
  A size with no variant goes in Max Mode when it is over Cursor's limit
package/index.mjs CHANGED
@@ -542,17 +542,26 @@ function modelsOf(picker, ids) {
542
542
  const id = m.name + "@" + c
543
543
  if (used.has(id)) continue
544
544
  used.add(id)
545
- out.push({ ...base, id, name: base.title + " @ " + c, context: tokensOf(c) || DEFAULT_CONTEXT, size: c })
545
+ out.push({ ...base, id, name: base.title + " @ " + c, context: tokensOf(c) || DEFAULT_CONTEXT, size: c, offersFast: fastAt(variants, c) })
546
546
  }
547
547
  } else if (!used.has(m.name)) {
548
548
  used.add(m.name)
549
549
  const limit = needsMax(m, def) ? m.contextTokenLimitForMaxMode || m.contextTokenLimit : m.contextTokenLimit
550
- out.push({ ...base, id: m.name === "default" ? "auto" : m.name, name: base.title, context: limit > 0 ? limit : DEFAULT_CONTEXT, size: "" })
550
+ out.push({ ...base, id: m.name === "default" ? "auto" : m.name, name: base.title, context: limit > 0 ? limit : DEFAULT_CONTEXT, size: "", offersFast: fastAt(variants, "") })
551
551
  }
552
552
  }
553
553
  return out
554
554
  }
555
555
 
556
+ // fastAt is whether Cursor has a fast variant the account is served at
557
+ // the context size (any, for a model without sizes): what magpie offers
558
+ // fast for, which 0.1.x said with a -fast model of its own.
559
+ const fastAt = (variants, size) =>
560
+ variants.some((v) => {
561
+ const have = valuesOf(v)
562
+ return have.fast === "true" && (!size || have.context === undefined || have.context === size)
563
+ })
564
+
556
565
  // nearest is the variant of vs most like the parameters wanted, one at
557
566
  // their context size before any other.
558
567
  function nearest(vs, want) {
@@ -734,6 +743,9 @@ function runtimeModel(m) {
734
743
  },
735
744
  release_date: "",
736
745
  variants: Object.fromEntries(efforts.map((e) => [e, { reasoningEffort: e }])),
746
+ // a request's service_tier priority (or fast) runs it as Cursor's fast
747
+ // variant: magpie offers Fast for the models that have one
748
+ ...(m.offersFast ? { fast: true } : {}),
737
749
  }
738
750
  }
739
751
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-cursor-auth",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",