dsh-plugin-subscription-oauth 0.16.3 → 0.17.1
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/README.dev.md +1 -1
- package/README.md +7 -6
- package/README.zh.dev.md +1 -1
- package/README.zh.md +7 -6
- package/lib/client/FastModeButton.d.ts +0 -1
- package/lib/client/FastModeButton.js +48 -11
- package/lib/client.js +32 -9
- package/lib/client.js.map +1 -1
- package/lib/index.js +21 -0
- package/lib/protocol.d.ts +9 -0
- package/lib/providers/antigravity.d.ts +34 -4
- package/lib/providers/antigravity.js +100 -28
- package/lib/providers/ark-provider.d.ts +10 -0
- package/lib/providers/ark-provider.js +16 -2
- package/lib/providers/ark.d.ts +104 -10
- package/lib/providers/ark.js +186 -48
- package/lib/providers/catalog.d.ts +92 -0
- package/lib/providers/catalog.js +191 -0
- package/lib/providers/common.d.ts +14 -0
- package/lib/providers/common.js +23 -0
- package/lib/providers/glm-provider.d.ts +10 -0
- package/lib/providers/glm-provider.js +16 -2
- package/lib/providers/glm.d.ts +100 -16
- package/lib/providers/glm.js +182 -85
- package/lib/providers/grok.d.ts +114 -27
- package/lib/providers/grok.js +330 -129
- package/lib/providers/kimi-provider.d.ts +10 -0
- package/lib/providers/kimi-provider.js +16 -4
- package/lib/providers/kimi.d.ts +122 -32
- package/lib/providers/kimi.js +243 -122
- package/lib/providers/mimo-provider.d.ts +14 -1
- package/lib/providers/mimo-provider.js +17 -6
- package/lib/providers/mimo.d.ts +164 -19
- package/lib/providers/mimo.js +318 -19
- package/lib/providers/model-cache.d.ts +57 -0
- package/lib/providers/model-cache.js +105 -0
- package/lib/providers/responses-stream.d.ts +8 -0
- package/lib/providers/responses-stream.js +21 -5
- package/lib/providers/workbuddy-provider.d.ts +17 -0
- package/lib/providers/workbuddy-provider.js +14 -6
- package/lib/providers/workbuddy.d.ts +140 -13
- package/lib/providers/workbuddy.js +501 -59
- package/package.json +1 -1
package/README.dev.md
CHANGED
|
@@ -70,7 +70,7 @@ quota, which is read per subscription period and per model's free allowance.
|
|
|
70
70
|
| --- | --- |
|
|
71
71
|
| `ctx.llm` | the `kimi`, `grok`, `antigravity`, `glm` and `auto` provider routes (models, reasoning efforts, streaming) |
|
|
72
72
|
| Settings | a **Subscriptions** section: one card per provider — sign in, sign out, default account, token refresh, plan quota, model catalog, manage dialog |
|
|
73
|
-
| Model picker | each provider's own models, plus **`auto` as its own route** spanning them
|
|
73
|
+
| Model picker | each provider's own models, plus **`auto` as its own route** spanning them. Membership comes from the provider's own model list, read once and cached as that route's table (`~/.dsh/plugins/kimi-oauth/model-catalog.json`), so the picker never spends a request and a release or retirement server-side needs no plugin update. Kimi serves `kimi-for-coding`, `k3` (1M) and `k3-256k`; Grok adds whatever its live catalog reports on top of `grok-4.6`/`grok-4.5`; Antigravity lists the agent-callable subset of what its endpoint reports (`fetchAvailableModels`), filtering out tabs, commit-message and transcription surfaces; GLM adds whatever its coding host lists on top of the `glm-5.3` family |
|
|
74
74
|
|
|
75
75
|
Credentials live at `~/.dsh/plugins/kimi-oauth/auth.json` (mode `0600`,
|
|
76
76
|
written atomically, one section per provider). The directory keeps the name this
|
package/README.md
CHANGED
|
@@ -13,12 +13,12 @@ Sign in once per provider from **Settings → Subscriptions** and that provider'
|
|
|
13
13
|
|
|
14
14
|
| Provider | What you get | Sign-in |
|
|
15
15
|
| --- | --- | --- |
|
|
16
|
-
| **Kimi Code** | `kimi-for-coding`, `k3
|
|
17
|
-
| **Grok (X Premium)** | `grok-4.7
|
|
18
|
-
| **Google Antigravity** | Claude Sonnet/Opus, Gemini Flash, GPT-OSS, with reasoning tiers | Google account OAuth |
|
|
19
|
-
| **GLM (BigModel)** | `glm-5.3`, `glm-5.3-flash
|
|
20
|
-
| **Volcengine Ark** |
|
|
21
|
-
| **Xiaomi MiMo** | MiMo
|
|
16
|
+
| **Kimi Code** | `kimi-for-coding`, `k3` (1M), `k3-256k` — read from the endpoint's own model list | OAuth device flow (show code, confirm in browser) |
|
|
17
|
+
| **Grok (X Premium)** | whatever the account's own model list reports (e.g. `grok-4.7`), **⚡ lightspeed** fast variant | Browser OAuth (auto-redirect) |
|
|
18
|
+
| **Google Antigravity** | Claude Sonnet/Opus, Gemini Flash, GPT-OSS, with reasoning tiers — read from the account's own list | Google account OAuth |
|
|
19
|
+
| **GLM (BigModel)** | whatever the coding host lists (e.g. `glm-5.3`, `glm-5.3-flash`) | ZCode browser sign-in (polled) |
|
|
20
|
+
| **Volcengine Ark** | the plan's own coding models | Volcengine SSO |
|
|
21
|
+
| **Xiaomi MiMo** | MiMo's own model list, with the app's two-model set as the fallback | Xiaomi account (QR / password) |
|
|
22
22
|
| **WorkBuddy (国内版)** | Hy, GLM, Kimi, DeepSeek, MiniMax models | Browser OAuth (Tencent) |
|
|
23
23
|
|
|
24
24
|
Every provider also feeds the **`auto`** route, which spans them all: pick `auto` and the harness walks your enabled models in order until one answers.
|
|
@@ -28,6 +28,7 @@ Every provider also feeds the **`auto`** route, which spans them all: pick `auto
|
|
|
28
28
|
- **One sign-in per provider** — no API keys to find, paste, or rotate. The plugin runs the provider's own OAuth/device flow and keeps the token on disk (`~/.dsh/plugins/kimi-oauth/auth.json`, mode `0600`).
|
|
29
29
|
- **Live plan usage** — the Settings card and the composer chip show each account's remaining quota (Kimi's 5-hour / weekly windows + credit, Grok's weekly credit, Antigravity's Gemini + Claude buckets, GLM/Ark/MiMo/WorkBuddy credits), with a meter and reset time.
|
|
30
30
|
- **Model picker integration** — each provider's models appear in the session picker with context windows and reasoning tiers; hide or re-order them per provider.
|
|
31
|
+
- **Catalogs come from the provider, not from this build** — every route reads its own model list once and caches it as the provider's table, so a model released, renamed or retired server-side shows up (or disappears) without a plugin update. Signing in and the Settings **refresh models** action are what re-read it; browsing the picker never spends a request.
|
|
31
32
|
- **⚡ Fast / lightspeed variants** — for models that have one (e.g. Grok 4.7 → `grok-4.7-build-fast`), a bolt button beside the model selector switches to the fast variant; it reads as a reasoning rung so the base model always stays selectable.
|
|
32
33
|
- **Cross-account pool** — sign in to several accounts on one provider; the plugin draws on the next account when one's allowance runs out.
|
|
33
34
|
- **Auto fallback** — `auto` moves to the next enabled model when a provider refuses the preferred one (renamed, rate-limited, out of quota), and stops falling back once a stream has started.
|
package/README.zh.dev.md
CHANGED
|
@@ -56,7 +56,7 @@ Antigravity 的流程是 Google 的桌面 OAuth 客户端(`accounts.google.com
|
|
|
56
56
|
| --- | --- |
|
|
57
57
|
| `ctx.llm` | `kimi`、`grok`、`antigravity`、`glm` 和 `auto` 提供方路由(模型、推理强度、流式输出) |
|
|
58
58
|
| Settings | 一个 **Subscriptions** 区域:每个提供方一张卡片——登录、退出登录、默认账户、令牌刷新、套餐配额、模型目录、管理对话框 |
|
|
59
|
-
| 模型选择器 | 每个提供方自己的模型,外加**作为独立路由的 `auto
|
|
59
|
+
| 模型选择器 | 每个提供方自己的模型,外加**作为独立路由的 `auto`**,横跨它们。成员资格来自提供方自己的模型列表:每个路由只读取一次并缓存为该路由的目录(`~/.dsh/plugins/kimi-oauth/model-catalog.json`),因此选择器不会发出请求,服务端新增或下线模型也无需插件更新。Kimi 提供 `kimi-for-coding`、`k3`(1M)与 `k3-256k`;Grok 在 `grok-4.6`、`grok-4.5` 之上加入其实时目录所报告的任何模型;Antigravity 列出其端点所报告内容(`fetchAvailableModels`)中可供 agent 调用的子集,过滤掉 tabs、commit-message 和 transcription 相关层面;GLM 在 `glm-5.3` 系列之上加入其编码主机所列出的一切 |
|
|
60
60
|
|
|
61
61
|
凭证存放在 `~/.dsh/plugins/kimi-oauth/auth.json`(模式 `0600`,原子写入,每个提供方
|
|
62
62
|
一个区段)。该目录保留了本插件在只服务 Kimi Code 时所用的名称:它保存着**活跃的
|
package/README.zh.md
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
| 服务 | 可用模型 | 登录方式 |
|
|
15
15
|
| --- | --- | --- |
|
|
16
|
-
| **Kimi Code** | `kimi-for-coding`、`k3
|
|
17
|
-
| **Grok (X Premium)** | `grok-4.7
|
|
18
|
-
| **Google Antigravity** | Claude Sonnet/Opus、Gemini Flash、GPT-OSS,带推理档 | Google 账号 OAuth |
|
|
19
|
-
| **GLM (BigModel)** | `glm-5.3`、`glm-5.3-flash
|
|
20
|
-
| **Volcengine Ark** |
|
|
21
|
-
| **Xiaomi MiMo** | MiMo
|
|
16
|
+
| **Kimi Code** | `kimi-for-coding`、`k3`(1M)、`k3-256k` —— 直接来自端点自己的模型列表 | OAuth 设备流(显示代码,浏览器确认) |
|
|
17
|
+
| **Grok (X Premium)** | 账号自己的模型列表所报告的一切(如 `grok-4.7`),**⚡ lightspeed** 快速变体 | 浏览器 OAuth(自动回调) |
|
|
18
|
+
| **Google Antigravity** | Claude Sonnet/Opus、Gemini Flash、GPT-OSS,带推理档 —— 来自账号自己的列表 | Google 账号 OAuth |
|
|
19
|
+
| **GLM (BigModel)** | 编码主机列出的一切(如 `glm-5.3`、`glm-5.3-flash`) | ZCode 浏览器登录(轮询) |
|
|
20
|
+
| **Volcengine Ark** | 套餐自己的编程模型 | 火山引擎 SSO |
|
|
21
|
+
| **Xiaomi MiMo** | MiMo 自己的模型列表,读取失败时回退到应用内置的两个模型 | 小米账号(扫码 / 密码) |
|
|
22
22
|
| **WorkBuddy (国内版)** | Hy、GLM、Kimi、DeepSeek、MiniMax 模型 | 浏览器 OAuth(腾讯) |
|
|
23
23
|
|
|
24
24
|
每个服务也会汇入 **`auto`** 路由,它横跨全部:选 `auto`,harness 会按顺序尝试你已启用的模型,直到有响应。
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
- **每个服务登录一次** —— 无需找、贴、轮换 API Key。插件运行服务自己的 OAuth/设备流,令牌保存在磁盘(`~/.dsh/plugins/kimi-oauth/auth.json`,权限 `0600`)。
|
|
29
29
|
- **实时套餐额度** —— 设置卡片和输入框 chip 显示每个账号的剩余额度(Kimi 的 5 小时 / 每周窗口 + 额度,Grok 每周额度,Antigravity 的 Gemini + Claude 分组,GLM/Ark/MiMo/WorkBuddy 的额度),带进度条和重置时间。
|
|
30
30
|
- **模型选择器集成** —— 每个服务的模型带上下文窗口和推理档出现在选择器里;可按服务隐藏或排序。
|
|
31
|
+
- **模型目录来自服务本身,而不是本插件** —— 每个路由只读取一次服务自己的模型列表,并把它缓存为该路由的目录,因此服务端新增、改名或下线的模型无需插件更新即可出现(或消失)。重新读取的时机是登录成功和设置页的**刷新模型**;浏览选择器不会发出任何请求。
|
|
31
32
|
- **⚡ 快速 / lightspeed 变体** —— 对有快速变体的模型(如 Grok 4.7 → `grok-4.7-build-fast`),模型选择器旁的闪电按钮一键切换;它作为推理档实现,基础模型始终可选。
|
|
32
33
|
- **多账号池** —— 一个服务可登录多个账号;某账号额度用尽时自动切到下一个。
|
|
33
34
|
- **Auto 回退** —— `auto` 在首选模型被拒(改名、限流、额度尽)时改用下一个已启用模型,且流开始后不再回退。
|
|
@@ -23,7 +23,6 @@ import type { SessionStandardProps } from '@deepseek-ai/dsh-client-ui-slots';
|
|
|
23
23
|
import type { SubscriptionsCall } from './subscriptions-rpc.js';
|
|
24
24
|
/** Injected props the button is registered with. */
|
|
25
25
|
export interface FastModeButtonInjected {
|
|
26
|
-
/** The plugin's own RPC caller, for the one `model-variants` read. */
|
|
27
26
|
call: SubscriptionsCall;
|
|
28
27
|
/** Whether the provider is one this plugin serves. */
|
|
29
28
|
isOwnProvider: (provider: string) => boolean;
|
|
@@ -22,6 +22,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
22
22
|
import { useEffect, useState } from 'react';
|
|
23
23
|
import { providerOf } from './UsageChip.js';
|
|
24
24
|
import { fastModeCss } from './styles.js';
|
|
25
|
+
/**
|
|
26
|
+
* How many times a *loading* route is re-asked, and how long between attempts.
|
|
27
|
+
*
|
|
28
|
+
* The route answers `pending` while it has not read its listing, which is the only case
|
|
29
|
+
* worth asking again: a route that has read its listing and reports no variant means the
|
|
30
|
+
* model truly has none, and the button stays absent without further reads.
|
|
31
|
+
*/
|
|
32
|
+
const VARIANT_READ_ATTEMPTS = 6;
|
|
33
|
+
const VARIANT_READ_INTERVAL_MS = 1_000;
|
|
25
34
|
/**
|
|
26
35
|
* The quick-mode control, for the composer's row of standard controls.
|
|
27
36
|
*
|
|
@@ -43,17 +52,45 @@ export function FastModeButton({ call, isOwnProvider, modelDirectory, useProject
|
|
|
43
52
|
return;
|
|
44
53
|
}
|
|
45
54
|
let live = true;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
let timer;
|
|
56
|
+
// A variant is derived from the route's model listing, which is read asynchronously and
|
|
57
|
+
// may still be in flight when the composer mounts (a cold start, or the first run after
|
|
58
|
+
// an update). The route says so with `pending`, and only then is it worth asking again:
|
|
59
|
+
// a route that has read its listing and names no variant has answered for good.
|
|
60
|
+
let attempts = 0;
|
|
61
|
+
const ask = () => {
|
|
62
|
+
attempts += 1;
|
|
63
|
+
void call('model-variants', { provider, id: model })
|
|
64
|
+
.then((result) => {
|
|
65
|
+
if (!live)
|
|
66
|
+
return;
|
|
67
|
+
if (result?.fast !== undefined) {
|
|
68
|
+
// The rung is the provider's own word (xAI `lightspeed`, Kimi `highspeed`), so
|
|
69
|
+
// the picker reads a name the model's own docs use, not a generic "Fast".
|
|
70
|
+
setPair({ rung: result.fastRung ?? 'fast' });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
setPair(undefined);
|
|
74
|
+
// Still reading its listing: ask again, up to the cap, then accept the answer.
|
|
75
|
+
if (result?.pending === true && attempts < VARIANT_READ_ATTEMPTS) {
|
|
76
|
+
timer = setTimeout(ask, VARIANT_READ_INTERVAL_MS);
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
.catch(() => {
|
|
80
|
+
// A read that failed outright is worth one more try, on the same budget.
|
|
81
|
+
if (!live)
|
|
82
|
+
return;
|
|
83
|
+
setPair(undefined);
|
|
84
|
+
if (attempts < VARIANT_READ_ATTEMPTS)
|
|
85
|
+
timer = setTimeout(ask, VARIANT_READ_INTERVAL_MS);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
ask();
|
|
89
|
+
return () => {
|
|
90
|
+
live = false;
|
|
91
|
+
if (timer !== undefined)
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
};
|
|
57
94
|
}, [provider, model, isOwnProvider, call]);
|
|
58
95
|
// A switch that landed clears the reason, so the marker follows the truth on screen.
|
|
59
96
|
useEffect(() => { setFailure(undefined); }, [model]);
|
package/lib/client.js
CHANGED
|
@@ -3061,6 +3061,15 @@ function UsageChip({ call, t, isOwnProvider, accountBalance, ccSwitchBalance, us
|
|
|
3061
3061
|
//#endregion
|
|
3062
3062
|
//#region src/client/FastModeButton.tsx
|
|
3063
3063
|
/**
|
|
3064
|
+
* How many times a *loading* route is re-asked, and how long between attempts.
|
|
3065
|
+
*
|
|
3066
|
+
* The route answers `pending` while it has not read its listing, which is the only case
|
|
3067
|
+
* worth asking again: a route that has read its listing and reports no variant means the
|
|
3068
|
+
* model truly has none, and the button stays absent without further reads.
|
|
3069
|
+
*/
|
|
3070
|
+
const VARIANT_READ_ATTEMPTS = 6;
|
|
3071
|
+
const VARIANT_READ_INTERVAL_MS = 1e3;
|
|
3072
|
+
/**
|
|
3064
3073
|
* The quick-mode control, for the composer's row of standard controls.
|
|
3065
3074
|
*
|
|
3066
3075
|
* @param props - injected RPC caller, directory, and the session standard kit.
|
|
@@ -3079,17 +3088,31 @@ function FastModeButton({ call, isOwnProvider, modelDirectory, useProjection })
|
|
|
3079
3088
|
return;
|
|
3080
3089
|
}
|
|
3081
3090
|
let live = true;
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
+
let timer;
|
|
3092
|
+
let attempts = 0;
|
|
3093
|
+
const ask = () => {
|
|
3094
|
+
attempts += 1;
|
|
3095
|
+
call("model-variants", {
|
|
3096
|
+
provider,
|
|
3097
|
+
id: model
|
|
3098
|
+
}).then((result) => {
|
|
3099
|
+
if (!live) return;
|
|
3100
|
+
if (result?.fast !== void 0) {
|
|
3101
|
+
setPair({ rung: result.fastRung ?? "fast" });
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3104
|
+
setPair(void 0);
|
|
3105
|
+
if (result?.pending === true && attempts < VARIANT_READ_ATTEMPTS) timer = setTimeout(ask, VARIANT_READ_INTERVAL_MS);
|
|
3106
|
+
}).catch(() => {
|
|
3107
|
+
if (!live) return;
|
|
3108
|
+
setPair(void 0);
|
|
3109
|
+
if (attempts < VARIANT_READ_ATTEMPTS) timer = setTimeout(ask, VARIANT_READ_INTERVAL_MS);
|
|
3110
|
+
});
|
|
3111
|
+
};
|
|
3112
|
+
ask();
|
|
3091
3113
|
return () => {
|
|
3092
3114
|
live = false;
|
|
3115
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
3093
3116
|
};
|
|
3094
3117
|
}, [
|
|
3095
3118
|
provider,
|