dsh-plugin-subscription-oauth 0.4.0 → 0.5.0
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/ccswitch.d.ts +36 -0
- package/lib/auth/ccswitch.js +75 -0
- package/lib/auth/rpc.d.ts +8 -1
- package/lib/auth/rpc.js +29 -17
- package/lib/client/UsageChip.d.ts +70 -2
- package/lib/client/UsageChip.js +116 -1
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +17 -1
- package/lib/client/subscriptions-rpc.d.ts +53 -1
- package/lib/client/subscriptions-rpc.js +56 -0
- package/lib/client.js +241 -2
- package/lib/client.js.map +1 -1
- package/lib/protocol.d.ts +50 -1
- package/lib/protocol.js +1 -0
- package/package.json +1 -1
package/lib/protocol.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/** Prefix of every RPC method this plugin serves. */
|
|
13
13
|
export declare const RPC_PREFIX = "subscription-oauth.";
|
|
14
14
|
/** Endpoints the Settings page may call. */
|
|
15
|
-
export declare const RPC_ENDPOINTS: readonly ["status", "login", "cancel", "logout", "setDefault", "refresh", "discover", "setModelVisible", "setModelOrder", "addModel", "removeModel", "usage", "reload"];
|
|
15
|
+
export declare const RPC_ENDPOINTS: readonly ["status", "login", "cancel", "logout", "setDefault", "refresh", "discover", "setModelVisible", "setModelOrder", "addModel", "removeModel", "usage", "reload", "ccswitch-balance"];
|
|
16
16
|
/** One endpoint name. */
|
|
17
17
|
export type RpcEndpoint = typeof RPC_ENDPOINTS[number];
|
|
18
18
|
/** Client → host envelope. */
|
|
@@ -313,4 +313,53 @@ export interface RpcMap {
|
|
|
313
313
|
payload: undefined;
|
|
314
314
|
value: SubscriptionStatus;
|
|
315
315
|
};
|
|
316
|
+
'ccswitch-balance': {
|
|
317
|
+
payload: CcSwitchBalanceRequest;
|
|
318
|
+
value: CcSwitchBalanceResult;
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/** One currency's wallet balance, as the platform reports it. */
|
|
322
|
+
export interface WalletBalance {
|
|
323
|
+
/** ISO currency the balance is denominated in. */
|
|
324
|
+
currency: 'CNY' | 'USD' | string;
|
|
325
|
+
/** Remaining balance, as a decimal string. */
|
|
326
|
+
balance: string;
|
|
327
|
+
}
|
|
328
|
+
/** The DeepSeek account's wallet balances, normalised from the host's account service. */
|
|
329
|
+
export interface AccountBalance {
|
|
330
|
+
/** Normal (topped-up) wallets, one per currency. */
|
|
331
|
+
wallets: readonly WalletBalance[];
|
|
332
|
+
/** Bonus / promotional wallets, one per currency. */
|
|
333
|
+
bonusWallets: readonly WalletBalance[];
|
|
316
334
|
}
|
|
335
|
+
/** Result of reading the DeepSeek account's balance through the host. */
|
|
336
|
+
export type BalanceResult =
|
|
337
|
+
/** The account answered with its balances. */
|
|
338
|
+
{
|
|
339
|
+
ok: true;
|
|
340
|
+
balance: AccountBalance;
|
|
341
|
+
}
|
|
342
|
+
/** The account is signed out, or the read failed. */
|
|
343
|
+
| {
|
|
344
|
+
ok: false;
|
|
345
|
+
};
|
|
346
|
+
/** Payload of `ccswitch-balance`. */
|
|
347
|
+
export interface CcSwitchBalanceRequest {
|
|
348
|
+
/** The credential reference the provider's profile names (its apiKeyEnv). */
|
|
349
|
+
credentialRef: string;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Result of `ccswitch-balance`.
|
|
353
|
+
*
|
|
354
|
+
* `undefined` means the provider did not answer with a balance — no key, a key it
|
|
355
|
+
* rejects, or a body that is not the balance shape. A chip shows nothing rather than a
|
|
356
|
+
* wrong figure, so this is deliberately not an error.
|
|
357
|
+
*/
|
|
358
|
+
export type CcSwitchBalanceResult = {
|
|
359
|
+
/** The currency the balance is denominated in. */
|
|
360
|
+
currency: string;
|
|
361
|
+
/** The remaining balance, as a decimal string. */
|
|
362
|
+
total: string;
|
|
363
|
+
/** Whether the account reports itself as usable. */
|
|
364
|
+
available: boolean;
|
|
365
|
+
} | undefined;
|
package/lib/protocol.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-subscription-oauth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|