dsh-plugin-subscription-oauth 0.8.12 → 0.8.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.
- package/lib/auth/provider-controller.d.ts +2 -0
- package/lib/auth/provider-controller.js +14 -10
- package/lib/auth/registry.d.ts +5 -1
- package/lib/auth/registry.js +5 -0
- package/lib/auth/rpc.js +9 -0
- package/lib/client.js.map +1 -1
- package/lib/protocol.d.ts +16 -1
- package/lib/protocol.js +1 -0
- package/lib/providers/ark-provider.js +4 -0
- package/lib/providers/ark.d.ts +4 -0
- package/lib/providers/ark.js +16 -2
- package/lib/providers/glm-provider.js +4 -0
- package/lib/providers/glm.d.ts +4 -0
- package/lib/providers/glm.js +16 -2
- package/lib/providers/grok.d.ts +10 -0
- package/lib/providers/grok.js +45 -5
- package/lib/providers/kimi-provider.js +9 -0
- package/lib/providers/kimi.d.ts +8 -0
- package/lib/providers/kimi.js +32 -2
- package/package.json +1 -1
|
@@ -69,6 +69,8 @@ export interface ProviderSpec<S extends SessionBase> {
|
|
|
69
69
|
applyDiscovery?(ids: readonly string[]): void;
|
|
70
70
|
/** Read one account's plan and metered allowances, when the provider states them. */
|
|
71
71
|
usage?(accessToken: string, account: string): Promise<ProviderUsageRead | undefined>;
|
|
72
|
+
/** The fast/lightspeed variant wire id for a base model, when the provider reported one. */
|
|
73
|
+
fastVariant?(baseId: string): string | undefined;
|
|
72
74
|
}
|
|
73
75
|
/** What a provider's usage read returns, before the controller stamps it. */
|
|
74
76
|
export interface ProviderUsageRead {
|
|
@@ -168,16 +168,20 @@ export class ProviderController {
|
|
|
168
168
|
// A hand-added id the adapter has not merged yet is appended here, with the
|
|
169
169
|
// conservative metadata this build can honestly state. The adapter carries the
|
|
170
170
|
// same ids for the picker; this list must not depend on its async refresh.
|
|
171
|
-
const rows = listed.map((entry) =>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
const rows = listed.map((entry) => {
|
|
172
|
+
const fast = this.options.spec.fastVariant?.(entry.id);
|
|
173
|
+
return {
|
|
174
|
+
id: entry.id,
|
|
175
|
+
name: entry.name,
|
|
176
|
+
...entry.description === undefined ? {} : { description: entry.description },
|
|
177
|
+
contextWindow: entry.contextWindow,
|
|
178
|
+
...entry.inputModalities === undefined ? {} : { inputModalities: entry.inputModalities },
|
|
179
|
+
...entry.defaultEffort === undefined ? {} : { defaultEffort: entry.defaultEffort },
|
|
180
|
+
visible: !hidden.has(entry.id),
|
|
181
|
+
...userAdded.has(entry.id) ? { userAdded: true } : {},
|
|
182
|
+
...fast === undefined ? {} : { fastVariant: fast },
|
|
183
|
+
};
|
|
184
|
+
});
|
|
181
185
|
for (const id of added) {
|
|
182
186
|
if (known.has(id) || own.has(id))
|
|
183
187
|
continue;
|
package/lib/auth/registry.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module dsh-plugin-subscription-oauth/auth/registry
|
|
10
10
|
*/
|
|
11
|
-
import type { LoginStart, ProviderStatus, RefreshResult, SubscriptionStatus, UsageResult } from '../protocol.js';
|
|
11
|
+
import type { LoginStart, ModelVariants, ProviderStatus, RefreshResult, SubscriptionStatus, UsageResult } from '../protocol.js';
|
|
12
12
|
import type { LlmAdapter } from '@deepseek-ai/dsh-llm';
|
|
13
13
|
import type { ProviderLoginStart, ProviderRefreshResult, ProviderUsageResult } from './provider-controller.js';
|
|
14
14
|
/** Everything the registry needs from one provider route. */
|
|
@@ -31,6 +31,8 @@ export interface ProviderRoute {
|
|
|
31
31
|
removeModel(id: string): Promise<ProviderStatus>;
|
|
32
32
|
usage(force?: boolean): Promise<ProviderUsageResult>;
|
|
33
33
|
reload(): Promise<ProviderStatus>;
|
|
34
|
+
/** Fast and image variants for one model, when the route's discovery reported them. */
|
|
35
|
+
modelVariants?(id: string): Promise<ModelVariants | undefined> | ModelVariants | undefined;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Routes every Settings call to the provider it names.
|
|
@@ -88,4 +90,6 @@ export declare class SubscriptionRegistry {
|
|
|
88
90
|
usage(provider: string, force?: boolean): Promise<UsageResult>;
|
|
89
91
|
/** Re-read every credential file and the shared preferences. */
|
|
90
92
|
reload(): Promise<SubscriptionStatus>;
|
|
93
|
+
/** The fast and image variants for one model, as the route's discovery reported them. */
|
|
94
|
+
modelVariants(provider: string, id: string): Promise<ModelVariants | undefined>;
|
|
91
95
|
}
|
package/lib/auth/registry.js
CHANGED
|
@@ -146,4 +146,9 @@ export class SubscriptionRegistry {
|
|
|
146
146
|
await Promise.all([...this.byId.values()].map((route) => route.reload()));
|
|
147
147
|
return this.status();
|
|
148
148
|
}
|
|
149
|
+
/** The fast and image variants for one model, as the route's discovery reported them. */
|
|
150
|
+
async modelVariants(provider, id) {
|
|
151
|
+
const route = this.route(provider);
|
|
152
|
+
return route.modelVariants?.(id);
|
|
153
|
+
}
|
|
149
154
|
}
|
package/lib/auth/rpc.js
CHANGED
|
@@ -185,6 +185,15 @@ async function runEndpoint(registry, endpoint, payload, balance) {
|
|
|
185
185
|
return await queryUsageBalance({ apiKey, baseUrl })
|
|
186
186
|
?? await queryCcSwitchBalance({ apiKey, baseUrl });
|
|
187
187
|
}
|
|
188
|
+
case 'model-variants': {
|
|
189
|
+
// The fast variant for one model, as the route's discovery reported it. The picker
|
|
190
|
+
// uses this to show a quick-mode button without listing the variant as its own row.
|
|
191
|
+
const provider = requiredProvider(payload, endpoint);
|
|
192
|
+
const id = typeof payload.id === 'string' ? payload.id : undefined;
|
|
193
|
+
if (id === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
return registry.modelVariants(provider, id);
|
|
196
|
+
}
|
|
188
197
|
case 'reload':
|
|
189
198
|
return registry.reload();
|
|
190
199
|
default:
|