dsh-coding-subscription-oauth 0.5.2 → 0.5.3

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.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 🔐 dsh-coding-subscription-oauth
6
6
 
7
- **v0.5.2** · formerly `dsh-grok-build`
7
+ **v0.5.3** · formerly `dsh-grok-build`
8
8
 
9
9
  **Coding-subscription OAuth for [DeepSeek Harness](https://github.com/deepseek-ai/dsh).** Use SuperGrok / X Premium (Grok Build), ChatGPT Plus/Pro (Codex), Kimi Code, Claude Pro/Max and Google Antigravity inside DSH — without a second API-key bill and **without pasting any token into chat.**
10
10
 
@@ -23,8 +23,8 @@ Published first as **`dsh-grok-build`** when it only covered Grok Build. The cur
23
23
 
24
24
  | | Use this | Still works |
25
25
  |---|---|---|
26
- | npm (recommended) | Current release is `0.5.2`: `dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2` | No legacy npm package was published |
27
- | GitHub / development | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | `github:lninghaha/dsh-grok-build` (same `main`) |
26
+ | npm (recommended) | Current release is `0.5.3`: `dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3` | No legacy npm package was published |
27
+ | GitHub / development | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | Previous GitHub repo `dsh-grok-build` was removed |
28
28
  | CLI | `dsh-coding-oauth` | `dsh-grok-build` |
29
29
  | Cordis plugin id | `llm-grok-build-oauth` | unchanged |
30
30
  | Settings HTTP API | `/plugins/dsh-grok-build/*` | unchanged |
@@ -32,7 +32,7 @@ Published first as **`dsh-grok-build`** when it only covered Grok Build. The cur
32
32
 
33
33
  ## ✨ Features
34
34
 
35
- - 🧾 **Bring your own subscription** — SuperGrok, ChatGPT Plus/Pro, Kimi Code, Claude Pro/Max; no extra pay-as-you-go key.
35
+ - 🧽 **Bring your own subscription** — SuperGrok, ChatGPT Plus/Pro, Kimi Code, Claude Pro/Max; no extra pay-as-you-go key.
36
36
  - 🔑 **Local OAuth, no key-pasting** — authorize in Settings or CLI; access/refresh tokens never enter chat, logs or HTTP status.
37
37
  - 🧩 **One plugin, five providers** — Grok Build (`cli-chat-proxy.grok.com`), Codex, Kimi Code, Claude Code and Google Antigravity.
38
38
  - 🛡️ **Secure by design** — credential files are owner-only `0600`, atomically written, cross-process locked.
@@ -77,7 +77,7 @@ Grok Build device login, live `/v1/models-v2` and Responses streaming are verifi
77
77
 
78
78
  ```bash
79
79
  # 1. install the current npm release into the web profile
80
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
80
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
81
81
 
82
82
  # 2. optional — Google Antigravity (pinned, reviewed version)
83
83
  dsh plugin --profile web add dsh-agy@0.1.2
@@ -91,7 +91,10 @@ Then open **Settings → Coding OAuth** and sign in to any provider. Done — pi
91
91
  ## 📚 Table of contents
92
92
 
93
93
  - [Name change](#name-change)
94
+ - [Features](#-features)
94
95
  - [Problems this plugin solves](#problems-this-plugin-solves)
96
+ - [Supported providers](#supported-providers)
97
+ - [Quick start](#-quick-start)
95
98
  - [Install](#install)
96
99
  - [Settings page](#settings-page)
97
100
  - [Optional capabilities](#optional-capabilities)
@@ -105,6 +108,7 @@ Then open **Settings → Coding OAuth** and sign in to any provider. Done — pi
105
108
  - [Technical notes](#technical-notes)
106
109
  - [Compliance](#compliance)
107
110
  - [Documentation](#documentation)
111
+ - [Related](#related)
108
112
  - [Contributing](#contributing)
109
113
  - [License](#license)
110
114
 
@@ -114,7 +118,7 @@ Requires DeepSeek Harness `0.1.0-rc.6+` and Node.js 22.19+. Full details in the
114
118
 
115
119
  ```bash
116
120
  # current npm release
117
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
121
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
118
122
 
119
123
  # development / alternative: from GitHub
120
124
  dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
@@ -123,7 +127,7 @@ dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
123
127
  # dsh plugin --profile web add ./dsh-coding-subscription-oauth
124
128
  ```
125
129
 
126
- Restart `dsh web` after installing. Verification against a live deployment:
130
+ Restart `dsh web` after installing. Maintainers can verify a live deployment from a source checkout (npm installs do not include these scripts):
127
131
 
128
132
  ```bash
129
133
  pnpm run verify:deployed # checks real /api/llm.models + OAuth state
@@ -178,7 +182,7 @@ gateway:
178
182
 
179
183
  Endpoints: `GET /healthz`, `GET /v1/models`, `POST /v1/chat/completions`, `POST /v1/responses`, `POST /v1/messages`. A Bearer key is stored at `$DSH_HOME/.coding-oauth-gateway.json` (`0600`).
180
184
 
181
- On the **Gateway** tab, copy the OpenAI base URL (for example, `http://127.0.0.1:18080/v1`), the Anthropic base URL, or the current Bearer key without rotating it. Key rotation requires confirmation. Edit the listen port with **Apply** or fill it with **Random** (`18100`–`18999`); the selected port is persisted in the owner-only gateway document, and a running listener rebinds to it. Bind remains YAML-only; a non-loopback bind requires a key. This is not a remote relay.
185
+ On the **Gateway** tab, copy the OpenAI base URL (for example, `http://127.0.0.1:18080/v1`), the Anthropic base URL, or the current Bearer key without rotating it. Key reveal is loopback-only and is never persisted to browser storage. Key rotation requires confirmation. Edit the listen port with **Apply** or fill it with **Random** (`18100`–`18999`); the selected port is persisted in the owner-only gateway document, and a running listener rebinds to it. Bind remains YAML-only; a non-loopback bind requires a key. This is not a remote relay.
182
186
 
183
187
  ## CLI
184
188
 
@@ -218,16 +222,16 @@ Only reviewed subscription domains are proxied (xAI/Grok, OpenAI Codex, Claude/A
218
222
 
219
223
  OAuth access tokens refresh proactively **five minutes** before their stored expiry (pi-ai 0.84+), so a request never rides a token into its final seconds. If an upstream still rejects a locally-valid token with 401/403 — server-side revocation or clock skew — the plugin backdates the stored credential and the retried step refreshes before reuse, recovering transparently instead of failing the turn.
220
224
 
221
- Request retries use the harness retry policy: transient failures (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **and `AUTH`** retry with exponential backoff (default 2 retries, 500 ms → 10 s, 10% jitter). Quota exhaustion and a dead refresh token are **not** retried — they fail fast with the real message and a sign-in prompt. Override per deployment:
225
+ Request retries use the harness retry policy: transient failures (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **and `AUTH`** retry with exponential backoff (default 5 retries, 5 s → 10 s → 20 s → 40 s → 80 s, ~155 s stacked, 10% jitter). xAI “at capacity / high demand / priority processing” finish messages are remapped to `RATE_LIMIT` so they enter this policy (pi-ai would otherwise label them `PI_AI_ERROR` when upstream `error.code` is null). Quota exhaustion and a dead refresh token are **not** retried — they fail fast with the real message and a sign-in prompt. Override per deployment:
222
226
 
223
227
  ```yaml
224
228
  - id: llm-grok-build-oauth
225
229
  config:
226
230
  retryPolicy:
227
231
  mode: normal
228
- maxRetries: 2
232
+ maxRetries: 5
229
233
  retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
230
- backoff: { initialDelayMs: 500, maxDelayMs: 10000, jitterRatio: 0.1 }
234
+ backoff: { initialDelayMs: 5000, maxDelayMs: 80000, jitterRatio: 0.1 }
231
235
  ```
232
236
 
233
237
  ## Credentials
package/README.pt-BR.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 🔐 dsh-coding-subscription-oauth
6
6
 
7
- **v0.5.2 · antigo `dsh-grok-build`
7
+ **v0.5.3 · antigo `dsh-grok-build`
8
8
 
9
9
  **Plugin de OAuth para assinaturas de codificação do [DeepSeek Harness](https://github.com/deepseek-ai/dsh).** Entre com as assinaturas que você já paga — depois use os modelos delas a partir da página de configurações do dsh ou da CLI. **Nenhum token colado no chat.**
10
10
 
@@ -24,7 +24,7 @@ O projeto começou como **`dsh-grok-build`** (só Grok Build). Agora cobre Super
24
24
  | | Use isto | Ainda funciona |
25
25
  |---|---|---|
26
26
  | GitHub / `dsh plugin add` | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | `github:lninghaha/dsh-grok-build` (mesmo `main`) |
27
- | npm | `dsh-coding-subscription-oauth@0.5.2` (versão atual) | Nenhum pacote npm legado foi publicado |
27
+ | npm | `dsh-coding-subscription-oauth@0.5.3` (versão atual) | Nenhum pacote npm legado foi publicado |
28
28
  | CLI | `dsh-coding-oauth` | `dsh-grok-build` |
29
29
  | Cordis plugin id | `llm-grok-build-oauth` | inalterado |
30
30
  | API HTTP das configurações | `/plugins/dsh-grok-build/*` | inalterado |
@@ -36,8 +36,11 @@ O projeto começou como **`dsh-grok-build`** (só Grok Build). Agora cobre Super
36
36
  - 🔑 **OAuth local, sem colar chave** — autorize na página de configurações ou na CLI; os tokens nunca entram no chat.
37
37
  - 🧩 **Um plugin, cinco provedores** — Grok Build, Codex, Kimi, Claude e Google Antigravity.
38
38
  - 🛡️ **Seguro por design** — arquivos de credenciais com permissão somente-dono `0600`, escrita atômica, bloqueio de arquivo entre processos.
39
- - ⚙️ **Catálogo dinâmico** — o seletor de modelos lista exatamente os provedores que você autenticou.
39
+ - ⚙️ **Catálogo dinâmico** — o seletor lista apenas rotas autenticadas, rotuladas com `(OAuth)`, incluindo o `xhigh` do grok-4.6.
40
40
  - 🌐 **Ciente de proxy** — faz proxy apenas de domínios de assinatura revisados e confiáveis.
41
+ - 📥 **CLI Pull manual** — as configurações descobrem os arquivos OAuth oficiais dos CLIs Grok/Codex/Kimi/Claude permitidos, somente leitura; você puxa uma cópia de via única após pré-visualização e confirmação de sobrescrita.
42
+ - 🗂️ **Configurações em abas** — Accounts, Gateway, Capabilities e About substituem a rolagem longa; os cartões de provedores conectados ficam recolhidos até serem expandidos.
43
+ - 🎛️ **Capacidades opcionais, padrão desligado** — busca do Codex, uso/cota, geração/edição de imagens, Fast e Grok Imagine são aplicadas ao vivo quando ativadas.
41
44
  - 🔌 **Gateway de API local opt-in** — servidor loopback compatível com OpenAI/Anthropic, desligado por padrão; para as suas próprias ferramentas, nunca um relé público.
42
45
 
43
46
  ## Problemas de integração que este plugin resolve
@@ -71,7 +74,7 @@ Estas são as buscas e erros do DSH que costumam trazer as pessoas até aqui.
71
74
 
72
75
  ```bash
73
76
  # 1. instale o plugin no perfil web (versão atual do npm)
74
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
77
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
75
78
 
76
79
  # 2. opcional — Google Antigravity (versão fixa revisada)
77
80
  dsh plugin --profile web add dsh-agy@0.1.2
@@ -85,9 +88,13 @@ Depois abra **Settings → Coding OAuth** e faça login em qualquer provedor. Pr
85
88
  ## 📚 Sumário
86
89
 
87
90
  - [Mudança de nome](#mudança-de-nome)
91
+ - [Recursos](#-recursos)
88
92
  - [Problemas de integração que este plugin resolve](#problemas-de-integração-que-este-plugin-resolve)
93
+ - [Provedores suportados](#provedores-suportados)
94
+ - [Início rápido](#-início-rápido)
89
95
  - [Instalação](#instalação)
90
96
  - [Página de configurações](#página-de-configurações)
97
+ - [Capacidades opcionais](#capacidades-opcionais)
91
98
  - [Gateway de API local](#gateway-de-api-local)
92
99
  - [CLI](#cli)
93
100
  - [Kimi na China](#kimi-na-china)
@@ -98,6 +105,7 @@ Depois abra **Settings → Coding OAuth** e faça login em qualquer provedor. Pr
98
105
  - [Notas técnicas](#notas-técnicas)
99
106
  - [Conformidade](#conformidade)
100
107
  - [Documentação](#documentação)
108
+ - [Relacionados](#relacionados)
101
109
  - [Contribuição](#contribuição)
102
110
  - [Licença](#licença)
103
111
 
@@ -107,7 +115,7 @@ Requer DeepSeek Harness `0.1.0-rc.6+` e Node.js 22.19+. Detalhes completos nas [
107
115
 
108
116
  ```bash
109
117
  # versão atual do npm (recomendado)
110
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
118
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
111
119
 
112
120
  # desenvolvimento/alternativo: do GitHub
113
121
  dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
@@ -201,16 +209,16 @@ Apenas domínios de assinatura revisados são usados via proxy (xAI/Grok, OpenAI
201
209
 
202
210
  Os tokens de acesso OAuth são renovados **cinco minutos** antes do vencimento armazenado (pi-ai 0.84+). Se o upstream ainda rejeitar um token localmente válido com 401/403, o plugin retrocede o `expires` gravado e o step repetido renova o token antes de reenviar.
203
211
 
204
- As novas tentativas seguem a política do harness: falhas transitórias (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **e `AUTH`** repetem com backoff exponencial (padrão: 2 tentativas, 500 ms → 10 s, 10% de jitter). Esgotamento de cota e refresh token morto **não** são repetidos. Sobrescrita por implantação:
212
+ As novas tentativas seguem a política do harness: falhas transitórias (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **e `AUTH`** repetem com backoff exponencial (padrão: 5 tentativas, 5 s → 10 s → 20 s → 40 s → 80 s (~155 s acumulados), 10% de jitter). Esgotamento de cota e refresh token morto **não** são repetidos. Sobrescrita por implantação:
205
213
 
206
214
  ```yaml
207
215
  - id: llm-grok-build-oauth
208
216
  config:
209
217
  retryPolicy:
210
218
  mode: normal
211
- maxRetries: 2
219
+ maxRetries: 5
212
220
  retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
213
- backoff: { initialDelayMs: 500, maxDelayMs: 10000, jitterRatio: 0.1 }
221
+ backoff: { initialDelayMs: 5000, maxDelayMs: 80000, jitterRatio: 0.1 }
214
222
  ```
215
223
 
216
224
  ## Credenciais
package/README.ru.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 🔐 dsh-coding-subscription-oauth
6
6
 
7
- **v0.5.2 · ранее `dsh-grok-build`
7
+ **v0.5.3 · ранее `dsh-grok-build`
8
8
 
9
9
  **Плагин OAuth для подписок на кодинг для [DeepSeek Harness](https://github.com/deepseek-ai/dsh).** Войдите один раз по уже оплаченным подпискам — и используйте их модели из страницы настроек или CLI dsh. **Никаких вставленных токенов в чат.**
10
10
 
@@ -24,7 +24,7 @@
24
24
  | | Используйте | По-прежнему работает |
25
25
  |---|---|---|
26
26
  | GitHub / `dsh plugin add` | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | `github:lninghaha/dsh-grok-build` (тот же `main`) |
27
- | npm | `dsh-coding-subscription-oauth@0.5.2` (текущая версия) | Старого npm-пакета не было |
27
+ | npm | `dsh-coding-subscription-oauth@0.5.3` (текущая версия) | Старого npm-пакета не было |
28
28
  | CLI | `dsh-coding-oauth` | `dsh-grok-build` |
29
29
  | Cordis plugin id | `llm-grok-build-oauth` | без изменений |
30
30
  | HTTP API страницы настроек | `/plugins/dsh-grok-build/*` | без изменений |
@@ -36,8 +36,11 @@
36
36
  - 🔑 **Локальный OAuth, без вставки ключа** — авторизация в странице настроек или CLI; токены никогда не попадают в чат.
37
37
  - 🧩 **Один плагин, пять провайдеров** — Grok Build, Codex, Kimi, Claude и Google Antigravity.
38
38
  - 🛡️ **Безопасность по замыслу** — файлы учётных данных только-владелец `0600`, атомарная запись, межпроцессная блокировка файла.
39
- - ⚙️ **Динамический каталог** — селектор моделей показывает ровно те провайдеры, которые вы авторизовали.
39
+ - ⚙️ **Динамический каталог** — селектор показывает только авторизованные маршруты с пометкой `(OAuth)`, включая `xhigh` для grok-4.6.
40
40
  - 🌐 **С учётом прокси** — проксируется только проверенные доверенные домены подписок.
41
+ - 📥 **Ручной CLI Pull** — настройки обнаруживают разрешённые официальные OAuth-файлы CLI Grok/Codex/Kimi/Claude только для чтения; вы забираете одностороннюю копию после предпросмотра и подтверждения перезаписи.
42
+ - 🗂️ **Настройки во вкладках** — Accounts, Gateway, Capabilities и About заменяют длинную прокрутку; карточки вошедших провайдеров свёрнуты, пока их не развернёшь.
43
+ - 🎛️ **Опциональные возможности, по умолчанию выключены** — поиск Codex, использование/квота, генерация/редактирование изображений, Fast и Grok Imagine применяются сразу при включении.
41
44
  - 🔌 **Локальный API-шлюз по opt-in** — по умолчанию выключенный loopback-сервер, совместимый с OpenAI/Anthropic; для ваших собственных инструментов, а не публичный relay.
42
45
 
43
46
  ## Какие проблемы подключения закрывает этот плагин
@@ -71,7 +74,7 @@
71
74
 
72
75
  ```bash
73
76
  # 1. установите текущую npm-версию в web-профиль
74
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
77
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
75
78
 
76
79
  # 2. опционально — Google Antigravity (зафиксированная проверенная версия)
77
80
  dsh plugin --profile web add dsh-agy@0.1.2
@@ -85,9 +88,13 @@ systemctl --user restart dsh-web.service
85
88
  ## 📚 Содержание
86
89
 
87
90
  - [Смена имени](#смена-имени)
91
+ - [Возможности](#-возможности)
88
92
  - [Какие проблемы подключения закрывает этот плагин](#какие-проблемы-подключения-закрывает-этот-плагин)
93
+ - [Поддерживаемые провайдеры](#поддерживаемые-провайдеры)
94
+ - [Быстрый старт](#-быстрый-старт)
89
95
  - [Установка](#установка)
90
96
  - [Страница настроек](#страница-настроек)
97
+ - [Дополнительные возможности](#дополнительные-возможности)
91
98
  - [Локальный API-шлюз](#локальный-api-шлюз)
92
99
  - [CLI](#cli)
93
100
  - [Kimi в Китае](#kimi-в-китае)
@@ -98,6 +105,7 @@ systemctl --user restart dsh-web.service
98
105
  - [Технические заметки](#технические-заметки)
99
106
  - [Соответствие](#соответствие)
100
107
  - [Документация](#документация)
108
+ - [Связанное](#связанное)
101
109
  - [Участие](#участие)
102
110
  - [Лицензия](#лицензия)
103
111
 
@@ -107,7 +115,7 @@ systemctl --user restart dsh-web.service
107
115
 
108
116
  ```bash
109
117
  # текущая npm-версия (рекомендуется)
110
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
118
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
111
119
 
112
120
  # разработка/альтернатива: из GitHub
113
121
  dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
@@ -201,16 +209,16 @@ OAuth подписки Kimi Code использует `https://auth.kimi.com`;
201
209
 
202
210
  OAuth access token обновляется **за пять минут** до сохранённого срока (pi-ai 0.84+). Если апстрим всё же отклоняет локально ещё живой токен кодом 401/403, плагин сдвигает сохранённый `expires` в прошлое, и повторный шаг сначала обновляет токен, затем повторяет запрос.
203
211
 
204
- Повторы идут по политике harness: временные сбои (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **и `AUTH`** повторяются с экспоненциальной задержкой (2 попытки, 500 мс → 10 с, 10% jitter). Исчерпание квоты и мёртвый refresh token **не** повторяются. Переопределение для развёртывания:
212
+ Повторы идут по политике harness: временные сбои (`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`) **и `AUTH`** повторяются с экспоненциальной задержкой (5 попыток, 5 с → 10 с → 20 с → 40 с → 80 с (~155 с суммарно), 10% jitter). Исчерпание квоты и мёртвый refresh token **не** повторяются. Переопределение для развёртывания:
205
213
 
206
214
  ```yaml
207
215
  - id: llm-grok-build-oauth
208
216
  config:
209
217
  retryPolicy:
210
218
  mode: normal
211
- maxRetries: 2
219
+ maxRetries: 5
212
220
  retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
213
- backoff: { initialDelayMs: 500, maxDelayMs: 10000, jitterRatio: 0.1 }
221
+ backoff: { initialDelayMs: 5000, maxDelayMs: 80000, jitterRatio: 0.1 }
214
222
  ```
215
223
 
216
224
  ## Учётные данные
package/README.zh-CN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # 🔐 dsh-coding-subscription-oauth
6
6
 
7
- **v0.5.2** · 原名 `dsh-grok-build`
7
+ **v0.5.3** · 原名 `dsh-grok-build`
8
8
 
9
9
  **面向 [DeepSeek Harness](https://github.com/deepseek-ai/dsh) 的编码订阅 OAuth 插件。** 把 SuperGrok / X Premium(Grok Build)、ChatGPT Plus/Pro(Codex)、Kimi Code、Claude Pro/Max 和 Google Antigravity 接到 DSH——不必再开一份按量 API-key,**也不要把 token 粘贴进聊天。**
10
10
 
@@ -23,8 +23,8 @@
23
23
 
24
24
  | | 请用这个 | 仍然可用 |
25
25
  |---|---|---|
26
- | npm(推荐) | 当前版本是 `0.5.2`:`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2` | 没有发布过旧 npm 包 |
27
- | GitHub / 开发安装 | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | `github:lninghaha/dsh-grok-build`(同一条 `main`) |
26
+ | npm(推荐) | 当前版本是 `0.5.3`:`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3` | 没有发布过旧 npm 包 |
27
+ | GitHub / 开发安装 | [`dsh-coding-subscription-oauth`](https://github.com/lninghaha/dsh-coding-subscription-oauth) | 旧仓库 `dsh-grok-build` 已删除 |
28
28
  | CLI | `dsh-coding-oauth` | `dsh-grok-build` |
29
29
  | Cordis 插件 id | `llm-grok-build-oauth` | 不变 |
30
30
  | 设置页 HTTP API | `/plugins/dsh-grok-build/*` | 不变 |
@@ -32,7 +32,7 @@
32
32
 
33
33
  ## ✨ 特性
34
34
 
35
- - 🧾 **自带订阅** —— SuperGrok、ChatGPT Plus/Pro、Kimi Code、Claude Pro/Max,不必另开按量 API-key。
35
+ - 🧳 **自带订阅** —— SuperGrok、ChatGPT Plus/Pro、Kimi Code、Claude Pro/Max,不必另开按量 API-key。
36
36
  - 🔑 **本地 OAuth,不用贴 key** —— 在设置页或 CLI 完成授权;access/refresh token 不进聊天、日志和 HTTP 状态。
37
37
  - 🧩 **一个插件,五大供应商** —— Grok Build(`cli-chat-proxy.grok.com`)、Codex、Kimi Code、Claude Code 与 Google Antigravity。
38
38
  - 🛡️ **安全设计** —— 凭据文件均为 owner-only `0600`、原子写、跨进程文件锁。
@@ -75,7 +75,7 @@
75
75
 
76
76
  ```bash
77
77
  # 1. 安装当前 npm 发布版到 web profile
78
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
78
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
79
79
 
80
80
  # 2. 可选 —— Google Antigravity(固定审核过的版本)
81
81
  dsh plugin --profile web add dsh-agy@0.1.2
@@ -89,7 +89,10 @@ systemctl --user restart dsh-web.service
89
89
  ## 📚 目录
90
90
 
91
91
  - [项目更名](#项目更名)
92
+ - [特性](#-特性)
92
93
  - [本插件解决的接入问题](#本插件解决的接入问题)
94
+ - [支持的供应商](#支持的供应商)
95
+ - [快速开始](#-快速开始)
93
96
  - [安装](#安装)
94
97
  - [设置页](#设置页)
95
98
  - [可选能力](#可选能力)
@@ -103,6 +106,7 @@ systemctl --user restart dsh-web.service
103
106
  - [技术方案](#技术方案)
104
107
  - [合规](#合规)
105
108
  - [文档](#文档)
109
+ - [相关项目](#相关项目)
106
110
  - [贡献](#贡献)
107
111
  - [许可证](#许可证)
108
112
 
@@ -112,7 +116,7 @@ systemctl --user restart dsh-web.service
112
116
 
113
117
  ```bash
114
118
  # 当前 npm 版本
115
- dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2
119
+ dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3
116
120
 
117
121
  # 开发 / 备用:从 GitHub 安装
118
122
  dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
@@ -121,7 +125,7 @@ dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
121
125
  # dsh plugin --profile web add ./dsh-coding-subscription-oauth
122
126
  ```
123
127
 
124
- 安装后重启 `dsh web`。对实际部署的验证:
128
+ 安装后重启 `dsh web`。维护者可在源码 checkout 中对实际部署做验证(npm 安装不包含这些脚本):
125
129
 
126
130
  ```bash
127
131
  pnpm run verify:deployed # 核对真实 /api/llm.models 与 OAuth 状态
@@ -176,7 +180,7 @@ gateway:
176
180
 
177
181
  端点:`GET /healthz`、`GET /v1/models`、`POST /v1/chat/completions`、`POST /v1/responses`、`POST /v1/messages`。Bearer key 保存在 `$DSH_HOME/.coding-oauth-gateway.json`(`0600`)。
178
182
 
179
- 在 **Gateway** 标签中,可以复制 OpenAI base URL(例如 `http://127.0.0.1:18080/v1`)、Anthropic base URL,或直接复制当前 Bearer key,不必轮换;轮换 key 前必须确认。监听端口可直接 **Apply/确定**,也可用 **Random/随机** 填充(`18100`–`18999`);选定端口会持久化到属主专用的网关文档,运行中的监听器会重新绑定。bind 仍只能写在 YAML 中;非 loopback bind 必须配置 key。这不是远程中继。
183
+ 在 **Gateway** 标签中,可以复制 OpenAI base URL(例如 `http://127.0.0.1:18080/v1`)、Anthropic base URL,或直接复制当前 Bearer key,不必轮换;密钥显示仅限 loopback,且不会写入浏览器存储;轮换 key 前必须确认。监听端口可直接 **Apply/确定**,也可用 **Random/随机** 填充(`18100`–`18999`);选定端口会持久化到属主专用的网关文档,运行中的监听器会重新绑定。bind 仍只能写在 YAML 中;非 loopback bind 必须配置 key。这不是远程中继。
180
184
 
181
185
  ## CLI
182
186
 
@@ -216,16 +220,16 @@ Kimi Code 订阅 OAuth 使用 `https://auth.kimi.com`;推理使用 `https://ap
216
220
 
217
221
  OAuth access token 会在本地记录过期时间前 **5 分钟**主动刷新(pi-ai 0.84+),避免请求踩到令牌寿命的最后几秒。若服务端仍以 401/403 拒绝一个本地尚未过期的令牌(服务端提前吊销或时钟偏差),插件会把凭据的 `expires` 回写到过去,重试的 step 会先刷新再发请求——用户无感知自愈,而不是本轮直接失败。
218
222
 
219
- 请求重试走 harness 的 retry 策略:瞬时故障(`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`)**以及 `AUTH`** 会按指数退避重试(默认 2 次,500 ms → 10 s10% jitter)。配额耗尽和 refresh token 失效**不**重试——会立刻给出真实错误和重新登录提示。部署级覆盖:
223
+ 请求重试走 harness 的 retry 策略:瞬时故障(`RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/`EMPTY_RESPONSE`)**以及 `AUTH`** 会按指数退避重试(默认 5 次,5 s → 10 s → 20 s → 40 s → 80 s,约 155 s 叠加时常,10% jitter)。xAI「at capacity / high demand / priority processing」等文案会在 finish 管道重映射为 `RATE_LIMIT`,从而进入该策略(上游 `error.code: null` 时 pi-ai 会标成 `PI_AI_ERROR`)。配额耗尽和 refresh token 失效**不**重试——会立刻给出真实错误和重新登录提示。部署级覆盖:
220
224
 
221
225
  ```yaml
222
226
  - id: llm-grok-build-oauth
223
227
  config:
224
228
  retryPolicy:
225
229
  mode: normal
226
- maxRetries: 2
230
+ maxRetries: 5
227
231
  retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
228
- backoff: { initialDelayMs: 500, maxDelayMs: 10000, jitterRatio: 0.1 }
232
+ backoff: { initialDelayMs: 5000, maxDelayMs: 80000, jitterRatio: 0.1 }
229
233
  ```
230
234
 
231
235
  ## 凭据
@@ -60,8 +60,9 @@ ctx.llm route
60
60
  - `oauth-session.ts`: login, refresh, static model catalog and model-selection cache.
61
61
  - `oauth-sources.ts`: allowlisted official Grok/Codex/Kimi/Claude CLI discovery; hardened lstat/`O_NOFOLLOW`/owner/mode/regular-file/size reads; one-use preview tickets (five minutes, max 32); never writes official CLI files.
62
62
  - `oauth-import-routes.ts`: same-origin Pull HTTP API (discover → preview → commit/cancel) into the destination store lock.
63
- - `alias-adapter.ts`: translates Harness routes, does not modify pi-ai `model.provider`, and runs a credential gate before `listModels()`; unauthenticated or unreadable credentials return an empty catalog, and the provider group name is `(OAuth)`. On an AUTH finish it invalidates the stored token so the harness retry can refresh first.
64
- - `adapter.ts`: composes Grok with the three subscription profiles; asks pi-ai for a 60 s remaining-validity floor and registers a retry policy that includes AUTH plus transient codes. Optionally wraps `codex-oauth-fast` as **Fast requested**.
63
+ - `alias-adapter.ts`: translates Harness routes, does not modify pi-ai `model.provider`, and runs a credential gate before `listModels()`; unauthenticated or unreadable credentials return an empty catalog, and the provider group name is `(OAuth)`. On an AUTH finish it invalidates the stored token so the harness retry can refresh first. The finish pipeline also remaps Kimi misclassified AUTH context overflow and xAI capacity wording → `RATE_LIMIT`.
64
+ - `grok-errors.ts`: detects xAI “at capacity / high demand / priority processing / overloaded” messages and rewrites them to `RATE_LIMIT` so they are not skipped as `PI_AI_ERROR`.
65
+ - `adapter.ts`: composes Grok with the three subscription profiles; asks pi-ai for a 60 s remaining-validity floor and registers a retry policy that includes AUTH plus transient codes (default 5 retries, 5 s → 80 s stacked exponential). Optionally wraps `codex-oauth-fast` as **Fast requested**.
65
66
  - `auth-routes.ts`: legacy Grok API + the unified `/plugins/dsh-grok-build/oauth/*`; JSON writes use a 64 KiB bounded reader and return 400/413 for malformed/oversized bodies.
66
67
  - `capability-settings.ts`: default-off live flags and limits (search 1–20, image count 1–4, artifact TTL 1 h–7 d).
67
68
  - `capability-routes.ts`: secret-free capability snapshot plus optional Codex usage and Imagine credential-status routes.
@@ -118,7 +119,7 @@ This project does not replicate the private Google Antigravity protocol. The pro
118
119
 
119
120
  ## 6. Compatibility
120
121
 
121
- The canonical package and repository name is **`dsh-coding-subscription-oauth`**. The previous GitHub URL still resolves to the same `main`, so old `dsh plugin add github:lninghaha/dsh-grok-build` commands continue to install the renamed package. The first public npm/GitHub Release was **`0.4.1`**. The current release is **`0.5.2`** (`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2`). GitHub and local tarball installs remain valid.
122
+ The canonical package and repository name is **`dsh-coding-subscription-oauth`**. The previous GitHub URL still resolves to the same `main`, so old `dsh plugin add github:lninghaha/dsh-grok-build` commands continue to install the renamed package. The first public npm/GitHub Release was **`0.4.1`**. The current release is **`0.5.3`** (`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3`). GitHub and local tarball installs remain valid.
122
123
 
123
124
  Stable on-disk / in-process identifiers (do not rename without a migration):
124
125
 
@@ -1,5 +1,9 @@
1
1
  # 02 · 架构设计
2
2
 
3
+ > 中文版 · [**English**](02-architecture.md)
4
+
5
+ 本文描述 `dsh-coding-subscription-oauth` 的内部架构,是 `README.md` 技术说明的来源,面向贡献者与维护者。
6
+
3
7
  ## 1. 路由与原生 provider
4
8
 
5
9
  ```text
@@ -56,8 +60,9 @@ ctx.llm route
56
60
  - `oauth-session.ts`:登录、刷新、静态模型目录和模型选择缓存。
57
61
  - `oauth-sources.ts`:白名单官方 Grok/Codex/Kimi/Claude CLI 发现;加固的 lstat/`O_NOFOLLOW`/属主/权限/普通文件/大小读取;一次性预览票据(五分钟、最多 32 张);从不写入官方 CLI 文件。
58
62
  - `oauth-import-routes.ts`:同源拉取 HTTP API(发现 → 预览 → 提交/取消),写入发生在目标 store 锁内。
59
- - `alias-adapter.ts`:转换 Harness route、不修改 pi-ai model.provider,并在 `listModels()` 前执行 credential gate;未认证或凭据读取失败返回空目录,provider group 名使用 `(OAuth)`。AUTH finish 时作废本地令牌,让 harness 重试先刷新。
60
- - `adapter.ts`:组合 Grok 与三个 subscription profile;向 pi-ai 要求至少 60 秒剩余有效期,并注册包含 AUTH 与瞬时故障码的 retryPolicy。可选包装 `codex-oauth-fast`,显示为 **已请求 Fast**。
63
+ - `alias-adapter.ts`:转换 Harness route、不修改 pi-ai model.provider,并在 `listModels()` 前执行 credential gate;未认证或凭据读取失败返回空目录,provider group 名使用 `(OAuth)`。AUTH finish 时作废本地令牌,让 harness 重试先刷新。finish 管道还会重映射 Kimi 误标 AUTH 的上下文溢出,以及 xAI capacity 文案 → `RATE_LIMIT`。
64
+ - `grok-errors.ts`:识别 xAI「at capacity / high demand / priority processing / overloaded」并改为 `RATE_LIMIT`,避免 `PI_AI_ERROR` 跳过退避。
65
+ - `adapter.ts`:组合 Grok 与三个 subscription profile;向 pi-ai 要求至少 60 秒剩余有效期,并注册包含 AUTH 与瞬时故障码的 retryPolicy(默认 5 次,5 s → 80 s 指数叠加)。可选包装 `codex-oauth-fast`,显示为 **已请求 Fast**。
61
66
  - `auth-routes.ts`:旧 Grok API + 新统一 `/plugins/dsh-grok-build/oauth/*`;JSON 写请求使用 64 KiB 有界读取器,无效/超限 body 分别返回 400/413。
62
67
  - `capability-settings.ts`:默认关闭、立即生效的开关与限制(搜索 1–20、图像 1–4、产物 TTL 1 小时–7 天)。
63
68
  - `capability-routes.ts`:无密钥的能力快照,以及可选的 Codex 用量和 Imagine 凭据状态路由。
@@ -114,7 +119,7 @@ POST /plugins/dsh-grok-build/gateway/rotate
114
119
 
115
120
  ## 6. 兼容性
116
121
 
117
- 正式包名与仓库名是 **`dsh-coding-subscription-oauth`**。旧 GitHub 地址仍指向同一条 `main`,因此旧的 `dsh plugin add github:lninghaha/dsh-grok-build` 仍会安装更名后的包。第一次公开 npm / GitHub Release 是 **`0.4.1`**。当前版本是 **`0.5.2`**(`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.2`)。GitHub 与本地 tarball 安装仍然有效。
122
+ 正式包名与仓库名是 **`dsh-coding-subscription-oauth`**。旧 GitHub 地址仍指向同一条 `main`,因此旧的 `dsh plugin add github:lninghaha/dsh-grok-build` 仍会安装更名后的包。第一次公开 npm / GitHub Release 是 **`0.4.1`**。当前版本是 **`0.5.3`**(`dsh plugin --profile web add dsh-coding-subscription-oauth@0.5.3`)。GitHub 与本地 tarball 安装仍然有效。
118
123
 
119
124
  以下标识保持稳定(无迁移方案前不要改名):
120
125
 
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAgC,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAkBzD,OAAO,KAAK,EAAE,oBAAoB,EAA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5
+ export declare function isXaiCapacityError(detail: string): boolean;
6
+ export declare function remapXaiCapacityFailure(failure: {
7
+ message: string;
8
+ code: string;
9
+ }): {
10
+ message: string;
11
+ code: string;
12
+ };
13
+ //# sourceMappingURL=grok-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-errors.d.ts","sourceRoot":"","sources":["../../src/grok-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACb,CAGA"}
package/lib/index.js CHANGED
@@ -25616,6 +25616,16 @@ import { PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
25616
25616
  // src/alias-adapter.ts
25617
25617
  import { LlmAdapter, LlmError } from "@deepseek-ai/dsh-llm";
25618
25618
 
25619
+ // src/grok-errors.ts
25620
+ var XAI_CAPACITY = /\b(?:at\s+capacity|high\s+demand|priority\s+processing|overloaded)\b/i;
25621
+ function isXaiCapacityError(detail) {
25622
+ return XAI_CAPACITY.test(detail);
25623
+ }
25624
+ function remapXaiCapacityFailure(failure) {
25625
+ if (!isXaiCapacityError(failure.message)) return failure;
25626
+ return { ...failure, code: "RATE_LIMIT" };
25627
+ }
25628
+
25619
25629
  // src/kimi-errors.ts
25620
25630
  import { CONTEXT_WINDOW_EXCEEDED_CODE, isContextWindowExceededError } from "@deepseek-ai/dsh-llm";
25621
25631
  var KIMI_CONTEXT_CAPACITY = /\bsupports only\s+\d+\s*k\s+context\b/i;
@@ -25697,7 +25707,7 @@ var AliasLlmAdapter = class extends LlmAdapter {
25697
25707
  ...raw,
25698
25708
  reason: {
25699
25709
  ...raw.reason,
25700
- failure: remapAuthFailureIfContextOverflow(raw.reason.failure)
25710
+ failure: remapXaiCapacityFailure(remapAuthFailureIfContextOverflow(raw.reason.failure))
25701
25711
  }
25702
25712
  } : raw;
25703
25713
  if (!authFailureNotified && chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === "AUTH") {
@@ -26632,9 +26642,9 @@ function missingCredential(name2) {
26632
26642
  var MIN_OAUTH_VALIDITY_MS = 6e4;
26633
26643
  var CODING_OAUTH_RETRY_POLICY = {
26634
26644
  mode: "normal",
26635
- maxRetries: 2,
26645
+ maxRetries: 5,
26636
26646
  retryableCodes: ["EMPTY_RESPONSE", "RATE_LIMIT", "SERVER", "TIMEOUT", "TRANSPORT", "AUTH"],
26637
- backoff: { initialDelayMs: 500, maxDelayMs: 1e4, jitterRatio: 0.1 }
26647
+ backoff: { initialDelayMs: 5e3, maxDelayMs: 8e4, jitterRatio: 0.1 }
26638
26648
  };
26639
26649
  function profile(provider, displayName, piProvider, retryPolicy, headers) {
26640
26650
  return {