@magpie-community/opencode-grok-auth 0.1.13 → 0.1.14

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 (2) hide show
  1. package/index.mjs +5 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -421,11 +421,12 @@ function windowsOf(d, efforts) {
421
421
  // grok-4.7@500k is grok-4.7 at 500000 tokens. The header is what the CLI
422
422
  // sends as x-grok-context-window. The proxy serves up to its largest
423
423
  // window either way and refuses past it; the header names the window the
424
- // caller asked to compact against.
424
+ // caller asked to compact against. A window no multiple of 1000 is named
425
+ // by its digits alone (grok-4.7@131072), as labelOf writes it.
425
426
  function modelOf(id) {
426
- const at = typeof id === "string" ? id.match(/^(.*)@(\d+)k$/) : null
427
- if (!at) return { model: id, window: 0 }
428
- return { model: at[1], window: Number(at[2]) * 1000 }
427
+ const at = typeof id === "string" ? id.match(/^(.+)@(\d+)(k?)$/) : null
428
+ if (!at || !(Number(at[2]) > 0)) return { model: id, window: 0 }
429
+ return { model: at[1], window: Number(at[2]) * (at[3] ? 1000 : 1) }
429
430
  }
430
431
 
431
432
  // ---- sign-in ------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-grok-auth",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "OpenCode provider plugin: Grok (SuperGrok / X Premium+) through the Grok Build CLI's sign-in",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",