@magpie-community/opencode-grok-auth 0.1.3 → 0.1.5

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 +17 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -225,8 +225,20 @@ function rewrite(body) {
225
225
 
226
226
  // ---- models -------------------------------------------------------------------
227
227
 
228
+ // the levels the built-in offered for grok-4.7 before Grok listed any (its
229
+ // maker's, as models.dev has them): kept when the list can't be read, so
230
+ // a move leaves an agent's reasoning level where it was
231
+ const DEFAULT_EFFORTS = ["low", "medium", "high", "xhigh"]
232
+
228
233
  const DEFAULT_MODELS = {
229
- "grok-4.7": { name: "Grok 4.7", attachment: true, reasoning: true, tool_call: true, modalities: { input: ["text", "image"], output: ["text"] } },
234
+ "grok-4.7": {
235
+ name: "Grok 4.7",
236
+ attachment: true,
237
+ reasoning: true,
238
+ tool_call: true,
239
+ modalities: { input: ["text", "image"], output: ["text"] },
240
+ variants: Object.fromEntries(DEFAULT_EFFORTS.map((e) => [e, { reasoningEffort: e }])),
241
+ },
230
242
  }
231
243
 
232
244
  // listModels is what the account can use, as the CLI's backend lists it:
@@ -237,6 +249,10 @@ async function listModels(key) {
237
249
  await sign(headers, key)
238
250
  const res = await fetch(`${BASE}/models`, { headers })
239
251
  const text = await res.text()
252
+ // a token Grok turned away before its time (signed out elsewhere) is a
253
+ // sign-in gone, said as one past its time is: a move takes it along
254
+ // untried rather than stopping on it
255
+ if (res.status === 401) throw new Error("Grok's sign-in has expired; run `grok login`")
240
256
  if (!res.ok) throw new Error(`Grok models: ${res.status} ${text.slice(0, 200)}`)
241
257
  const out = []
242
258
  for (const d of JSON.parse(text)?.data ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-grok-auth",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
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",