dsh-plugin-subscription-oauth 0.10.1 → 0.11.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.
@@ -8,7 +8,7 @@ import { REAUTH_REQUIRED, ProviderError } from '../errors.js';
8
8
  import { TokenStore } from '../auth/store.js';
9
9
  import { TokenManager } from '../auth/tokens.js';
10
10
  import { LOGIN_CANCELLED_MESSAGE } from '../auth/device-flow.js';
11
- import { finishMimoSignIn, mimoCredentialsFrom, refreshMimoSession, startMimoSignIn, waitMimoPoll, } from '../auth/mimo-flow.js';
11
+ import { finishMimoSignIn, mimoCredentialsFrom, readMimoUsage, refreshMimoSession, startMimoSignIn, waitMimoPoll, } from '../auth/mimo-flow.js';
12
12
  import { MimoAdapter, MIMO_CODE_URL, MIMO_CONTEXT_WINDOW, MIMO_DEFAULT_MODEL, MIMO_MODELS, MIMO_PROVIDER_ID, MIMO_PROVIDER_NAME, parseMimoSession, } from './mimo.js';
13
13
  import { ProviderController } from '../auth/provider-controller.js';
14
14
  import { proxiedFetch } from '../http.js';
@@ -132,7 +132,22 @@ export function createMimoProvider(options) {
132
132
  catalogOwn: () => adapter.ownCatalogEntries(),
133
133
  fallbackContextWindow: MIMO_CONTEXT_WINDOW,
134
134
  discover: () => Promise.resolve(undefined),
135
- usage: () => Promise.resolve({ windows: [] }),
135
+ usage: async (_accessToken, account) => {
136
+ const held = await store.get(account);
137
+ if (held === undefined)
138
+ return undefined;
139
+ let creds;
140
+ let cookies;
141
+ try {
142
+ creds = JSON.parse(held.mimoCreds);
143
+ cookies = JSON.parse(held.mimoCookies);
144
+ }
145
+ catch {
146
+ return undefined;
147
+ }
148
+ const read = await readMimoUsage({ cookies, userId: creds.userId }, creds, fetchFn);
149
+ return { plan: read.plan, ...read.renewsAt === undefined ? {} : { renewsAt: read.renewsAt }, windows: read.windows };
150
+ },
136
151
  details: () => [
137
152
  { key: 'provider', value: MIMO_PROVIDER_NAME },
138
153
  { key: 'credentialFile', value: options.credentialFile },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-subscription-oauth",
3
- "version": "0.10.1",
3
+ "version": "0.11.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",