dsh-plugin-subscription-oauth 0.8.8 → 0.8.10
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.
- package/lib/providers/grok.d.ts +4 -0
- package/lib/providers/grok.js +23 -1
- package/package.json +1 -1
package/lib/providers/grok.d.ts
CHANGED
|
@@ -112,6 +112,10 @@ interface GrokCliMetadata {
|
|
|
112
112
|
reasoningEfforts?: readonly string[];
|
|
113
113
|
defaultEffort?: string;
|
|
114
114
|
}
|
|
115
|
+
/** True when a model id names a fast/lightspeed variant of a base model. */
|
|
116
|
+
export declare function isFastVariant(id: string): boolean;
|
|
117
|
+
/** The base model id a fast variant belongs to (`grok-4.7-fast` → `grok-4.7`). */
|
|
118
|
+
export declare function baseModelOf(id: string): string;
|
|
115
119
|
/** Constructor dependencies for {@link GrokAdapter}. */
|
|
116
120
|
export interface GrokAdapterOptions {
|
|
117
121
|
/** API base; `<base>/responses` and `<base>/models`. */
|
package/lib/providers/grok.js
CHANGED
|
@@ -80,6 +80,13 @@ export const GROK_MODELS = [
|
|
|
80
80
|
contextWindow: GROK_CONTEXT_WINDOW,
|
|
81
81
|
inputModalities: ['text', 'image'],
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
id: 'grok-4.7',
|
|
85
|
+
name: 'Grok 4.7',
|
|
86
|
+
description: 'Latest flagship with extended context',
|
|
87
|
+
contextWindow: 500_000,
|
|
88
|
+
inputModalities: ['text', 'image'],
|
|
89
|
+
},
|
|
83
90
|
];
|
|
84
91
|
/**
|
|
85
92
|
* Coerce one decoded credential entry into a Grok session.
|
|
@@ -255,6 +262,16 @@ export async function refreshGrokToken(input) {
|
|
|
255
262
|
}
|
|
256
263
|
/** Model ids that are clearly not chat models. */
|
|
257
264
|
const NON_CHAT_ID = /(?:^|[-_/])(?:image|video|imagine|embed|embedding|whisper|tts|vision-only)/i;
|
|
265
|
+
/** Model ids that are the fast/lightspeed variant of a base model, matched per base. */
|
|
266
|
+
const FAST_VARIANT = /(?:^|[-_])(?:fast|lightspeed|turbo|quick)$/i;
|
|
267
|
+
/** True when a model id names a fast/lightspeed variant of a base model. */
|
|
268
|
+
export function isFastVariant(id) {
|
|
269
|
+
return FAST_VARIANT.test(id);
|
|
270
|
+
}
|
|
271
|
+
/** The base model id a fast variant belongs to (`grok-4.7-fast` → `grok-4.7`). */
|
|
272
|
+
export function baseModelOf(id) {
|
|
273
|
+
return id.replace(FAST_VARIANT, '');
|
|
274
|
+
}
|
|
258
275
|
/** Grok wire adapter: one instance serves the `grok` provider route. */
|
|
259
276
|
export class GrokAdapter extends LlmAdapter {
|
|
260
277
|
options;
|
|
@@ -507,13 +524,18 @@ export class GrokAdapter extends LlmAdapter {
|
|
|
507
524
|
return undefined;
|
|
508
525
|
}
|
|
509
526
|
const payload = await response.json();
|
|
527
|
+
// Fast/lightspeed variants ride with their base model: they share the base's
|
|
528
|
+
// visibility switch and are reached by a picker button, not a separate row.
|
|
510
529
|
const ids = (payload.data ?? [])
|
|
511
530
|
.map((entry) => entry.id)
|
|
512
|
-
.filter((id) => typeof id === 'string' && id.length > 0 && !NON_CHAT_ID.test(id))
|
|
531
|
+
.filter((id) => typeof id === 'string' && id.length > 0 && !NON_CHAT_ID.test(id))
|
|
532
|
+
.map((id) => (isFastVariant(id) ? baseModelOf(id) : id))
|
|
533
|
+
.filter((id, index, list) => list.indexOf(id) === index);
|
|
513
534
|
if (ids.length === 0) {
|
|
514
535
|
this.options.onWarn?.('xAI model discovery returned an empty catalog; using the built-in catalog');
|
|
515
536
|
return undefined;
|
|
516
537
|
}
|
|
538
|
+
// Keep the fast-variant ids discoverable for the picker button, keyed by their base.
|
|
517
539
|
const metadata = await this.fetchCliMetadata(fetchFn, signal);
|
|
518
540
|
for (const [id, meta] of metadata)
|
|
519
541
|
this.metadata.set(id, meta);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-subscription-oauth",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "Use subscription accounts as DeepSeek Harness LLM providers — Kimi Code (OAuth device flow), Grok / X Premium (OIDC + PKCE), Google Antigravity (Google OAuth + Cloud Code Assist) and GLM / BigModel (ZCode's browser sign-in) — with per-model visibility, drag-to-reorder Auto fallback and plan quotas from the web Settings page",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "EricFL1998",
|