dsh-plugin-subscription-oauth 0.8.9 → 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 +16 -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
|
@@ -262,6 +262,16 @@ export async function refreshGrokToken(input) {
|
|
|
262
262
|
}
|
|
263
263
|
/** Model ids that are clearly not chat models. */
|
|
264
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
|
+
}
|
|
265
275
|
/** Grok wire adapter: one instance serves the `grok` provider route. */
|
|
266
276
|
export class GrokAdapter extends LlmAdapter {
|
|
267
277
|
options;
|
|
@@ -514,13 +524,18 @@ export class GrokAdapter extends LlmAdapter {
|
|
|
514
524
|
return undefined;
|
|
515
525
|
}
|
|
516
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.
|
|
517
529
|
const ids = (payload.data ?? [])
|
|
518
530
|
.map((entry) => entry.id)
|
|
519
|
-
.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);
|
|
520
534
|
if (ids.length === 0) {
|
|
521
535
|
this.options.onWarn?.('xAI model discovery returned an empty catalog; using the built-in catalog');
|
|
522
536
|
return undefined;
|
|
523
537
|
}
|
|
538
|
+
// Keep the fast-variant ids discoverable for the picker button, keyed by their base.
|
|
524
539
|
const metadata = await this.fetchCliMetadata(fetchFn, signal);
|
|
525
540
|
for (const [id, meta] of metadata)
|
|
526
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",
|