dsh-coding-subscription-oauth 0.6.2 → 0.6.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/CHANGELOG.md +222 -206
- package/CONTRIBUTING.md +129 -120
- package/INSTALL.md +218 -218
- package/LICENSE +19 -19
- package/NOTICE +11 -11
- package/README.de.md +289 -289
- package/README.es.md +290 -290
- package/README.fr.md +290 -290
- package/README.ja.md +290 -290
- package/README.ko.md +290 -290
- package/README.md +304 -304
- package/README.pt-BR.md +290 -290
- package/README.ru.md +290 -290
- package/README.zh-CN.md +302 -302
- package/compatibility/dsh-bom.json +0 -0
- package/cordis.patch.yml +13 -13
- package/docs/00-project-rules.md +212 -195
- package/docs/02-architecture.md +130 -130
- package/docs/02-architecture.zh-CN.md +130 -130
- package/lib/bin.js.map +1 -1
- package/lib/capability-settings.d.ts +8 -2
- package/lib/capability-settings.d.ts.map +1 -1
- package/lib/capability-tools.d.ts +7 -2
- package/lib/capability-tools.d.ts.map +1 -1
- package/lib/client.js +3 -3
- package/lib/client.js.map +2 -2
- package/lib/codex-images.d.ts +8 -0
- package/lib/codex-images.d.ts.map +1 -1
- package/lib/index.js +32 -7
- package/lib/index.js.map +2 -2
- package/lib/invariant.js.map +1 -1
- package/media/en/settings_accounts.png +0 -0
- package/media/en/settings_capabilities.png +0 -0
- package/media/en/settings_gateway.png +0 -0
- package/media/settings_accounts.png +0 -0
- package/media/settings_capabilities.png +0 -0
- package/media/settings_gateway.png +0 -0
- package/media/settings_overview.png +0 -0
- package/media/zh-CN/settings_accounts.png +0 -0
- package/media/zh-CN/settings_capabilities.png +0 -0
- package/media/zh-CN/settings_gateway.png +0 -0
- package/package.json +148 -148
- package/patches/dsh-agy@0.1.2.patch +25 -25
- package/scripts/release.mjs +186 -186
- package/scripts/smoke-deployed-routes.mjs +146 -146
- package/scripts/verify-deployed-catalog.mjs +87 -87
- package/src/adapter.ts +273 -273
- package/src/alias-adapter.ts +130 -130
- package/src/auth-routes.ts +921 -921
- package/src/auth.ts +67 -67
- package/src/bin.ts +350 -350
- package/src/capability-routes.ts +279 -279
- package/src/capability-runtime.ts +314 -313
- package/src/capability-settings.ts +671 -658
- package/src/capability-tools.ts +685 -666
- package/src/catalog.ts +271 -271
- package/src/client/GrokBuildSettings.tsx +771 -770
- package/src/client/api.ts +88 -88
- package/src/client/components/AboutTab.tsx +30 -30
- package/src/client/components/AccountsTab.tsx +241 -241
- package/src/client/components/Badge.tsx +33 -33
- package/src/client/components/CapabilitiesTab.tsx +265 -265
- package/src/client/components/CliPullPreview.tsx +116 -116
- package/src/client/components/CopyButton.tsx +57 -57
- package/src/client/components/GatewayTab.tsx +469 -469
- package/src/client/components/NoticeBanner.tsx +46 -46
- package/src/client/components/ProgressBar.tsx +53 -53
- package/src/client/components/ProviderCard.tsx +606 -606
- package/src/client/components/SettingsTabs.tsx +75 -75
- package/src/client/components/ToggleSwitch.tsx +71 -71
- package/src/client/constants.ts +230 -224
- package/src/client/display.ts +61 -61
- package/src/client/dshClientAdapter.ts +127 -127
- package/src/client/gatewaySnippets.ts +37 -37
- package/src/client/index.tsx +156 -156
- package/src/client/locales.ts +540 -535
- package/src/client/microStyles.ts +52 -52
- package/src/client/parsers.ts +398 -396
- package/src/client/styles.ts +325 -325
- package/src/client/types.ts +199 -197
- package/src/codex-http.ts +447 -447
- package/src/codex-images.ts +503 -485
- package/src/codex-model-capabilities.ts +320 -320
- package/src/codex-search.ts +245 -245
- package/src/codex-usage.ts +263 -263
- package/src/compatibility.ts +41 -41
- package/src/dsh-host-adapter.ts +173 -173
- package/src/gateway-anthropic-messages.ts +84 -84
- package/src/gateway-auth.ts +102 -102
- package/src/gateway-backend.ts +274 -274
- package/src/gateway-body.ts +49 -49
- package/src/gateway-config.ts +76 -76
- package/src/gateway-http.ts +104 -104
- package/src/gateway-openai-chat.ts +124 -124
- package/src/gateway-openai-responses.ts +53 -53
- package/src/gateway-parse.ts +224 -224
- package/src/gateway-protocol.ts +52 -52
- package/src/gateway-routes.ts +158 -158
- package/src/gateway.ts +258 -258
- package/src/grok-errors.ts +24 -24
- package/src/grok-imagine.ts +1627 -1627
- package/src/grok-import.ts +151 -151
- package/src/http-json.ts +82 -82
- package/src/ids.ts +59 -59
- package/src/imagine-routes.ts +463 -463
- package/src/index.ts +709 -709
- package/src/invariant.ts +17 -17
- package/src/kimi-errors.ts +26 -26
- package/src/media-store.ts +927 -927
- package/src/oauth-import-routes.ts +324 -324
- package/src/oauth-providers.ts +152 -152
- package/src/oauth-session.ts +183 -183
- package/src/oauth-sources.ts +1104 -1104
- package/src/oauth.ts +620 -620
- package/src/provider.ts +128 -128
- package/src/proxy.ts +11 -11
- package/src/redact.ts +72 -72
- package/src/session.ts +218 -218
- package/src/store.ts +217 -217
- package/src/web-origin.ts +296 -296
- package/src/web-routes.ts +38 -38
package/INSTALL.md
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
# 安装与使用 · dsh-coding-subscription-oauth
|
|
2
|
-
|
|
3
|
-
本仓库原名 **`dsh-grok-build`**。普通用户请使用已发布的 npm 版本:
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
CLI 新命令是 `dsh-coding-oauth`(旧命令 `dsh-grok-build` 仍可用)。为兼容已有 profile,Cordis id 仍是 `llm-grok-build-oauth`,设置页 HTTP 路径仍是 `/plugins/dsh-grok-build/*`,凭据文件名不变。
|
|
10
|
-
|
|
11
|
-
第一次公开发布是 **`0.4.1`**。`0.6.1` 从未正式发布或打包,其未发布改动已合入当前推荐的 **`0.6.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.
|
|
15
|
-
dsh plugin --profile web update dsh-coding-subscription-oauth
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## 前置条件
|
|
19
|
-
|
|
1
|
+
# 安装与使用 · dsh-coding-subscription-oauth
|
|
2
|
+
|
|
3
|
+
本仓库原名 **`dsh-grok-build`**。普通用户请使用已发布的 npm 版本:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
CLI 新命令是 `dsh-coding-oauth`(旧命令 `dsh-grok-build` 仍可用)。为兼容已有 profile,Cordis id 仍是 `llm-grok-build-oauth`,设置页 HTTP 路径仍是 `/plugins/dsh-grok-build/*`,凭据文件名不变。
|
|
10
|
+
|
|
11
|
+
第一次公开发布是 **`0.4.1`**。`0.6.1` 从未正式发布或打包,其未发布改动已合入当前推荐的 **`0.6.3`**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3
|
|
15
|
+
dsh plugin --profile web update dsh-coding-subscription-oauth
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 前置条件
|
|
19
|
+
|
|
20
20
|
- DeepSeek Harness 0.1.1-rc.2(精确已验证 BOM)
|
|
21
|
-
- Node.js 22.19+
|
|
22
|
-
- 需要使用的个人编码订阅;没有 Claude/Google 账号也可以先安装路由
|
|
23
|
-
- 部分网络需要 HTTP/HTTPS 代理
|
|
24
|
-
|
|
25
|
-
## 安装
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# 普通用户:当前 npm 发布版
|
|
29
|
-
dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.
|
|
30
|
-
|
|
31
|
-
# 开发 / 备用:从 GitHub
|
|
32
|
-
dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
|
|
33
|
-
|
|
34
|
-
# 本地开发目录(备用)
|
|
35
|
-
# dsh plugin --profile web add ./dsh-coding-subscription-oauth
|
|
36
|
-
|
|
37
|
-
# Google Antigravity 可选依赖,固定版本
|
|
38
|
-
dsh plugin --profile web add dsh-agy@0.1.2
|
|
39
|
-
```
|
|
40
|
-
|
|
21
|
+
- Node.js 22.19+
|
|
22
|
+
- 需要使用的个人编码订阅;没有 Claude/Google 账号也可以先安装路由
|
|
23
|
+
- 部分网络需要 HTTP/HTTPS 代理
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 普通用户:当前 npm 发布版
|
|
29
|
+
dsh plugin --profile web add dsh-coding-subscription-oauth@0.6.3
|
|
30
|
+
|
|
31
|
+
# 开发 / 备用:从 GitHub
|
|
32
|
+
dsh plugin --profile web add github:lninghaha/dsh-coding-subscription-oauth
|
|
33
|
+
|
|
34
|
+
# 本地开发目录(备用)
|
|
35
|
+
# dsh plugin --profile web add ./dsh-coding-subscription-oauth
|
|
36
|
+
|
|
37
|
+
# Google Antigravity 可选依赖,固定版本
|
|
38
|
+
dsh plugin --profile web add dsh-agy@0.1.2
|
|
39
|
+
```
|
|
40
|
+
|
|
41
41
|
安装后重启现有 DSH Web 进程;不要另起一个端口相同的服务器。
|
|
42
42
|
|
|
43
43
|
## 升级注意事项
|
|
44
44
|
|
|
45
45
|
- 本版按 DSH `0.1.1-rc.2` 的精确兼容矩阵发布;生产环境应锁定已验证的 BOM,不要用 `*` 或未验证的宽泛 peer range。
|
|
46
46
|
- 从 `0.6.0` 升级到 `0.6.2` 后再重启:`0.6.0` 在严格 Cordis 注入检查下可能因读取尚未注入的可选服务而拖垮插件树。这个补丁不迁移或重置 OAuth 凭据、Gateway、模型/适配器 ID 与缓存。
|
|
47
|
-
- 在同一个 **web profile** 中先保证 `dsh-coding-oauth-core@0.1.0` 可从 npm 解析,再安装 Subscription `0.6.
|
|
48
|
-
- 共装 Hub 与 Subscription 时,先安装
|
|
47
|
+
- 在同一个 **web profile** 中先保证 `dsh-coding-oauth-core@0.1.0` 可从 npm 解析,再安装 Subscription `0.6.3`(以及需要的 `dsh-hub-oauth-gateway@1.10.0`)。Core 只是共享 npm 依赖,不是单独的 DSH 插件,用户不需要执行 `dsh plugin add dsh-coding-oauth-core`。
|
|
48
|
+
- 共装 Hub 与 Subscription 时,先安装 `dsh-hub-oauth-gateway@1.10.0` 与 Subscription `0.6.3`,完成后只重启一次现有 DSH Web 进程;Hub 提供完整用量中心,Subscription 显示紧凑状态入口。只升级 Subscription 仍可独立工作。
|
|
49
49
|
- 升级会保留既有 Cordis id、OAuth 凭据文件、模型/适配器 ID、Gateway 配置和模型缓存;不要为了“清理旧版本”删除这些文件。若旧包名 `dsh-grok-build` 仍在 profile 中,只移除那条旧插件记录,再安装当前包,避免重复路由。
|
|
50
50
|
- 回滚时恢复上一个插件版本并重启一次,保留凭据和配置;先查看兼容性诊断与失败原因,不要用清空凭据来代替回滚。
|
|
51
51
|
- DSH Web 与本地 Gateway 继续只绑定 loopback。远程 Settings 只能走 SSH 隧道或满足 owner proof、精确 Origin 和 CSRF proof 的 HTTPS 反向代理;升级不会放宽到 `0.0.0.0`。
|
|
52
52
|
|
|
53
53
|
本地 API 网关默认关闭。需要时在 profile 里打开(只绑 loopback):
|
|
54
|
-
|
|
55
|
-
```yaml
|
|
56
|
-
gateway:
|
|
57
|
-
enabled: true
|
|
58
|
-
bind: 127.0.0.1
|
|
59
|
-
port: 18080
|
|
60
|
-
```
|
|
61
|
-
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
gateway:
|
|
57
|
+
enabled: true
|
|
58
|
+
bind: 127.0.0.1
|
|
59
|
+
port: 18080
|
|
60
|
+
```
|
|
61
|
+
|
|
62
62
|
或在 Settings → Coding OAuth → Gateway 标签页打开。Bearer key 存在 `$DSH_HOME/.coding-oauth-gateway.json`。不要绑定 `0.0.0.0`。
|
|
63
63
|
|
|
64
64
|
## 安全访问远程 Settings
|
|
@@ -84,172 +84,172 @@ DSH Web 仍应只绑定 loopback。远程浏览器必须通过 SSH 隧道,或
|
|
|
84
84
|
若把同机反向代理的 loopback 地址列为 `peers`,来自该地址的所有请求都会按代理流量校验,不能再回退为本地请求。这是防止反代改写 `Host` 后绕过 proof 的安全边界;配置前应保留独立的 SSH 修复通道。
|
|
85
85
|
|
|
86
86
|
## Antigravity 安全配置
|
|
87
|
-
|
|
88
|
-
`dsh-agy@0.1.2` 的 `/agy` standalone dashboard 没有自己的认证,并包含凭据导出接口。Web 服务带 trusted-host 或反向代理时,建议在 profile 最终 `cordis.patch.yml` 禁用该 dashboard:
|
|
89
|
-
|
|
90
|
-
```yaml
|
|
91
|
-
- id: dsh-agy-web
|
|
92
|
-
disabled: true
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
这不会禁用 `agy` LLM route 或 profile 内的 `dsh-agy` CLI。
|
|
96
|
-
|
|
97
|
-
Google OAuth 后续可用:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
NODE_USE_ENV_PROXY=1 \
|
|
101
|
-
HTTPS_PROXY=http://127.0.0.1:7890 \
|
|
102
|
-
dsh plugin --profile web exec dsh-agy login --headless
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
仅在当前网络确实需要代理时设置 `NODE_USE_ENV_PROXY` / `HTTPS_PROXY`;其他环境直接执行最后一行即可。不要把 Google credential export 粘贴到聊天或日志。
|
|
106
|
-
|
|
107
|
-
## 代理配置
|
|
108
|
-
|
|
109
|
-
推荐在 profile 的最终 patch 里配置常驻服务:
|
|
110
|
-
|
|
111
|
-
```yaml
|
|
112
|
-
- id: llm-grok-build-oauth
|
|
113
|
-
config:
|
|
114
|
-
proxy: http://127.0.0.1:7890
|
|
115
|
-
proxyKimi: false
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
解析优先级:`config.proxy` → `CODING_OAUTH_PROXY` → `GROK_BUILD_PROXY` → `HTTPS_PROXY` / `HTTP_PROXY`。
|
|
119
|
-
|
|
120
|
-
默认进入代理的域名组:
|
|
121
|
-
|
|
122
|
-
- xAI/Grok Build
|
|
123
|
-
- OpenAI Codex
|
|
124
|
-
- Claude/Anthropic
|
|
125
|
-
- Google OAuth/Cloud Code
|
|
126
|
-
|
|
127
|
-
Kimi Code 中国流量默认直连;只有 `proxyKimi: true` 才代理。
|
|
128
|
-
|
|
129
|
-
## 弹性重试
|
|
130
|
-
|
|
131
|
-
OAuth access token 会在本地记录过期时间前 5 分钟主动刷新。服务端若仍以 401/403 拒绝一个本地尚未过期的令牌,插件会把凭据 `expires` 回写到过去,重试的 step 先刷新再发请求。瞬时故障(429/5xx/超时/网络)和 AUTH 默认最多重试 5 次(5 s → 10 s → 20 s → 40 s → 80 s,约 155 s 叠加时常,10% jitter)。xAI「at capacity」等文案会重映射为 `RATE_LIMIT` 后再退避。配额耗尽和 refresh token 失效不重试。
|
|
132
|
-
|
|
133
|
-
部署级覆盖(可选):
|
|
134
|
-
|
|
135
|
-
```yaml
|
|
136
|
-
- id: llm-grok-build-oauth
|
|
137
|
-
config:
|
|
138
|
-
retryPolicy:
|
|
139
|
-
mode: normal
|
|
140
|
-
maxRetries: 5
|
|
141
|
-
retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
|
|
142
|
-
backoff: { initialDelayMs: 5000, maxDelayMs: 80000, jitterRatio: 0.1 }
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## 登录
|
|
146
|
-
|
|
147
|
-
### 设置页
|
|
148
|
-
|
|
149
|
-
打开 **设置 → 编码 OAuth**:
|
|
150
|
-
|
|
151
|
-
- **Grok Build**:授权码或设备码
|
|
152
|
-
- **OpenAI Codex**:远程部署推荐设备码;浏览器 PKCE 支持粘贴 redirect URL
|
|
153
|
-
- **Kimi Code**:设备码
|
|
154
|
-
- **Claude Code**:浏览器 PKCE,远程访问时粘贴完整 localhost redirect URL
|
|
155
|
-
|
|
156
|
-
设置页会**只读发现**白名单内的官方 Grok / Codex / Kimi / Claude CLI OAuth 文件。同步是显式的单向**拉取**(不是自动导入):发现 → 预览 → 冲突/指纹核对 → 确认覆盖。官方 CLI 文件从不被写入。读取会拒绝符号链接、非普通文件、非属主文件、组/其他人可读,以及超大文档(`O_NOFOLLOW`)。预览票据一次性、五分钟过期、最多 32 张。CLI 的 `dsh-coding-oauth import` 仍只支持 Grok。
|
|
157
|
-
|
|
158
|
-
登录过程只交换授权 code;状态接口不返回 access/refresh token。
|
|
159
|
-
|
|
160
|
-
### 可选能力
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
数值控制为 `searchResults`(1–20,默认 5)、`imageCount`(1–4,默认 1)、`videoArtifactTtlMs`(1 小时–7 天,默认 7 天;界面以 1–168 小时显示)。降低视频保留时间会立即缩短并清理已有产物;提高只影响之后生成的产物。管理员可在插件配置的 `capabilities` 下提供不含秘密的 composition 默认值;`coding-subscription-oauth` 设置区中的用户值会覆盖该 base,省略时所有开关仍默认关闭。
|
|
165
|
-
|
|
166
|
-
`codex-oauth-fast` 仅在最新一次 live catalog 标明至少有一个 `priority` 可用模型后才会出现。请求发送 `service_tier: priority` 和路由提示;界面写 **已请求 Fast**,不保证延迟或上游兑现。Codex 搜索/用量/图像是需打开的私有 `chatgpt.com/backend-api` 端点;图像固定 `gpt-image-2`;编辑只接受当前会话顶层、本会话持有的附件。
|
|
167
|
-
|
|
168
|
-
Grok Imagine 只走官方 `https://api.x.ai`(`grok-imagine-image-2.0` / `grok-imagine-video-1.5`),凭据是独立的 DSH 引用 `XAI_API_KEY`——不用 Grok OAuth,也不回退进程环境变量。下载受 MIME / 大小 / 超时 / 重定向 / DNS 控制,冻结主机为 `imgen.x.ai`、`videogen.x.ai`、`vidgen.x.ai`;私有产物库的单件与唯一对象总量均硬限 256 MiB、最长七天;只通过同源 loopback 路由提供。
|
|
169
|
-
|
|
170
|
-
### CLI
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# Grok(`dsh-grok-build` 仍是同一条命令的别名)
|
|
174
|
-
dsh-coding-oauth login
|
|
175
|
-
dsh-coding-oauth login --pkce
|
|
176
|
-
dsh-coding-oauth import
|
|
177
|
-
|
|
178
|
-
# Codex / Kimi / Claude
|
|
179
|
-
dsh-coding-oauth login codex --device-auth
|
|
180
|
-
dsh-coding-oauth login codex --browser
|
|
181
|
-
dsh-coding-oauth login kimi
|
|
182
|
-
dsh-coding-oauth login claude
|
|
183
|
-
|
|
184
|
-
# 状态/登出
|
|
185
|
-
dsh-coding-oauth status all
|
|
186
|
-
dsh-coding-oauth logout kimi
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## 模型路由
|
|
190
|
-
|
|
191
|
-
- `grok-build/<model>`
|
|
192
|
-
- `codex-oauth/<model>`
|
|
193
|
-
- `codex-oauth-fast/<model>`(可选;仅在最新 live catalog 标明 `priority` 可用后出现,界面为 已请求 Fast)
|
|
194
|
-
- `kimi-code-oauth/<model>`
|
|
195
|
-
- `claude-code-oauth/<model>`
|
|
196
|
-
- `agy/<model>`(安装 dsh-agy 后)
|
|
197
|
-
|
|
198
|
-
这些别名专门避免与已有的 `xai`、`openai`、`kimi-coding` API-key routes 冲突。插件不会修改现有默认模型设置。未认证的 OAuth route 不向模型选择器返回任何模型;认证后供应商名显示为 `(OAuth)`,登录/登出会立即触发目录刷新。
|
|
199
|
-
|
|
200
|
-
## 凭据与缓存
|
|
201
|
-
|
|
202
|
-
OAuth 凭据:
|
|
203
|
-
|
|
204
|
-
```text
|
|
205
|
-
$DSH_HOME/.grok-build-auth.json
|
|
206
|
-
$DSH_HOME/.codex-oauth-auth.json
|
|
207
|
-
$DSH_HOME/.kimi-code-oauth-auth.json
|
|
208
|
-
$DSH_HOME/.claude-code-oauth-auth.json
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
均为 `0600`、原子写、文件锁保护。模型缓存为对应的 `*-models.json`,不含 token。Grok Imagine 使用 DSH 凭据引用 `XAI_API_KEY`,与上述 OAuth 文件分离;视频产物存入 `$DSH_HOME/.dsh-coding-subscription-oauth-media/`(目录 `0700`、文件 `0600`),按保留设置自动清理。
|
|
212
|
-
|
|
213
|
-
## 卸载
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
dsh plugin --profile web remove dsh-agy dsh-coding-subscription-oauth
|
|
217
|
-
rm -f ~/.dsh/.grok-build-auth.json ~/.dsh/.codex-oauth-auth.json \
|
|
218
|
-
~/.dsh/.kimi-code-oauth-auth.json ~/.dsh/.claude-code-oauth-auth.json
|
|
219
|
-
rm -f ~/.dsh/.grok-build-models.json ~/.dsh/.codex-oauth-models.json \
|
|
220
|
-
~/.dsh/.kimi-code-oauth-models.json ~/.dsh/.claude-code-oauth-models.json
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
只有在确认不再需要账号后才删除凭据文件。
|
|
224
|
-
|
|
225
|
-
## 部署验收
|
|
226
|
-
|
|
227
|
-
以下命令面向维护者,需要在源码 checkout 中运行;通过 npm 安装的用户无需执行。
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
pnpm run verify:deployed
|
|
231
|
-
|
|
232
|
-
DSH_RESTORE_PROVIDER=openai \
|
|
233
|
-
DSH_RESTORE_MODEL=gpt-5.6-sol \
|
|
234
|
-
DSH_RESTORE_REASONING=max \
|
|
235
|
-
pnpm run smoke:deployed
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
第一条命令验证真实模型目录的认证门禁和 `(OAuth)` 标签。第二条会通过运行中的 DSH 分别执行 Codex/Kimi 的 tool-call 与第二个用户 turn(覆盖 `INVALID_REPLAY_STATE` 回归),随后恢复显式指定的默认模型并归档测试会话;为避免覆盖现有默认设置,不提供 `DSH_RESTORE_*` 时脚本拒绝运行。
|
|
239
|
-
|
|
240
|
-
## 故障排查
|
|
241
|
-
|
|
242
|
-
| 现象 | 处理 |
|
|
243
|
-
|---|---|
|
|
244
|
-
| 还在搜 / 装着 `dsh-grok-build` | 仓库已更名为 `dsh-coding-subscription-oauth`;旧 GitHub 仓库已删除。请改用 npm 包或 `github:lninghaha/dsh-coding-subscription-oauth` |
|
|
245
|
-
| Codex localhost callback 打不开 | 改用设备码,或把完整 redirect URL 粘贴回设置页 |
|
|
246
|
-
| Claude localhost callback 在远端浏览器 | 把完整 redirect URL 粘贴回设置页 |
|
|
247
|
-
| Kimi 401/403 | 重新登录并确认 Kimi Code 会员有效;不要改成 moonshot.cn OAuth |
|
|
248
|
-
| OAuth refresh failed | 对应账号重新登录;插件不会回退到其他账号或 API key |
|
|
249
|
-
| 模型 route 重复 | 保留本插件的 `*-oauth` alias,移除冲突的第三方 OAuth 插件 |
|
|
250
|
-
| Antigravity 页面 404 | 安全配置默认禁用了 `dsh-agy-web`;使用 CLI |
|
|
251
|
-
| Google/Claude/OpenAI 网络不可达 | 检查插件 scoped proxy;不要重启或修改系统网络服务 |
|
|
252
|
-
|
|
253
|
-
## 合规提示
|
|
254
|
-
|
|
255
|
-
订阅 OAuth 接入第三方 harness 可能违反或触及供应商服务条款。仅供个人账号使用,自行承担配额和账号风险;商用请使用官方 API-key 通道。
|
|
87
|
+
|
|
88
|
+
`dsh-agy@0.1.2` 的 `/agy` standalone dashboard 没有自己的认证,并包含凭据导出接口。Web 服务带 trusted-host 或反向代理时,建议在 profile 最终 `cordis.patch.yml` 禁用该 dashboard:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
- id: dsh-agy-web
|
|
92
|
+
disabled: true
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
这不会禁用 `agy` LLM route 或 profile 内的 `dsh-agy` CLI。
|
|
96
|
+
|
|
97
|
+
Google OAuth 后续可用:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
NODE_USE_ENV_PROXY=1 \
|
|
101
|
+
HTTPS_PROXY=http://127.0.0.1:7890 \
|
|
102
|
+
dsh plugin --profile web exec dsh-agy login --headless
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
仅在当前网络确实需要代理时设置 `NODE_USE_ENV_PROXY` / `HTTPS_PROXY`;其他环境直接执行最后一行即可。不要把 Google credential export 粘贴到聊天或日志。
|
|
106
|
+
|
|
107
|
+
## 代理配置
|
|
108
|
+
|
|
109
|
+
推荐在 profile 的最终 patch 里配置常驻服务:
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
- id: llm-grok-build-oauth
|
|
113
|
+
config:
|
|
114
|
+
proxy: http://127.0.0.1:7890
|
|
115
|
+
proxyKimi: false
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
解析优先级:`config.proxy` → `CODING_OAUTH_PROXY` → `GROK_BUILD_PROXY` → `HTTPS_PROXY` / `HTTP_PROXY`。
|
|
119
|
+
|
|
120
|
+
默认进入代理的域名组:
|
|
121
|
+
|
|
122
|
+
- xAI/Grok Build
|
|
123
|
+
- OpenAI Codex
|
|
124
|
+
- Claude/Anthropic
|
|
125
|
+
- Google OAuth/Cloud Code
|
|
126
|
+
|
|
127
|
+
Kimi Code 中国流量默认直连;只有 `proxyKimi: true` 才代理。
|
|
128
|
+
|
|
129
|
+
## 弹性重试
|
|
130
|
+
|
|
131
|
+
OAuth access token 会在本地记录过期时间前 5 分钟主动刷新。服务端若仍以 401/403 拒绝一个本地尚未过期的令牌,插件会把凭据 `expires` 回写到过去,重试的 step 先刷新再发请求。瞬时故障(429/5xx/超时/网络)和 AUTH 默认最多重试 5 次(5 s → 10 s → 20 s → 40 s → 80 s,约 155 s 叠加时常,10% jitter)。xAI「at capacity」等文案会重映射为 `RATE_LIMIT` 后再退避。配额耗尽和 refresh token 失效不重试。
|
|
132
|
+
|
|
133
|
+
部署级覆盖(可选):
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
- id: llm-grok-build-oauth
|
|
137
|
+
config:
|
|
138
|
+
retryPolicy:
|
|
139
|
+
mode: normal
|
|
140
|
+
maxRetries: 5
|
|
141
|
+
retryableCodes: [EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, AUTH]
|
|
142
|
+
backoff: { initialDelayMs: 5000, maxDelayMs: 80000, jitterRatio: 0.1 }
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 登录
|
|
146
|
+
|
|
147
|
+
### 设置页
|
|
148
|
+
|
|
149
|
+
打开 **设置 → 编码 OAuth**:
|
|
150
|
+
|
|
151
|
+
- **Grok Build**:授权码或设备码
|
|
152
|
+
- **OpenAI Codex**:远程部署推荐设备码;浏览器 PKCE 支持粘贴 redirect URL
|
|
153
|
+
- **Kimi Code**:设备码
|
|
154
|
+
- **Claude Code**:浏览器 PKCE,远程访问时粘贴完整 localhost redirect URL
|
|
155
|
+
|
|
156
|
+
设置页会**只读发现**白名单内的官方 Grok / Codex / Kimi / Claude CLI OAuth 文件。同步是显式的单向**拉取**(不是自动导入):发现 → 预览 → 冲突/指纹核对 → 确认覆盖。官方 CLI 文件从不被写入。读取会拒绝符号链接、非普通文件、非属主文件、组/其他人可读,以及超大文档(`O_NOFOLLOW`)。预览票据一次性、五分钟过期、最多 32 张。CLI 的 `dsh-coding-oauth import` 仍只支持 Grok。
|
|
157
|
+
|
|
158
|
+
登录过程只交换授权 code;状态接口不返回 access/refresh token。
|
|
159
|
+
|
|
160
|
+
### 可选能力
|
|
161
|
+
|
|
162
|
+
设置页的八项订阅能力开关默认全部关闭,打开后立即生效(无需重启):`codexSearch`、`codexImages`、`codexImageEdits`、`codexImagesAnyModel`、`codexUsage`、`codexFast`、`grokImagineImage`、`grokImagineVideo`。`codexImagesAnyModel` 仅放宽调用模型路由限制;仍要求已登录 Codex、开启对应图像能力,并保留当前会话附件归属和编辑授权检查。
|
|
163
|
+
|
|
164
|
+
数值控制为 `searchResults`(1–20,默认 5)、`imageCount`(1–4,默认 1)、`videoArtifactTtlMs`(1 小时–7 天,默认 7 天;界面以 1–168 小时显示)。降低视频保留时间会立即缩短并清理已有产物;提高只影响之后生成的产物。管理员可在插件配置的 `capabilities` 下提供不含秘密的 composition 默认值;`coding-subscription-oauth` 设置区中的用户值会覆盖该 base,省略时所有开关仍默认关闭。
|
|
165
|
+
|
|
166
|
+
`codex-oauth-fast` 仅在最新一次 live catalog 标明至少有一个 `priority` 可用模型后才会出现。请求发送 `service_tier: priority` 和路由提示;界面写 **已请求 Fast**,不保证延迟或上游兑现。Codex 搜索/用量/图像是需打开的私有 `chatgpt.com/backend-api` 端点;图像固定 `gpt-image-2`;编辑只接受当前会话顶层、本会话持有的附件。
|
|
167
|
+
|
|
168
|
+
Grok Imagine 只走官方 `https://api.x.ai`(`grok-imagine-image-2.0` / `grok-imagine-video-1.5`),凭据是独立的 DSH 引用 `XAI_API_KEY`——不用 Grok OAuth,也不回退进程环境变量。下载受 MIME / 大小 / 超时 / 重定向 / DNS 控制,冻结主机为 `imgen.x.ai`、`videogen.x.ai`、`vidgen.x.ai`;私有产物库的单件与唯一对象总量均硬限 256 MiB、最长七天;只通过同源 loopback 路由提供。
|
|
169
|
+
|
|
170
|
+
### CLI
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Grok(`dsh-grok-build` 仍是同一条命令的别名)
|
|
174
|
+
dsh-coding-oauth login
|
|
175
|
+
dsh-coding-oauth login --pkce
|
|
176
|
+
dsh-coding-oauth import
|
|
177
|
+
|
|
178
|
+
# Codex / Kimi / Claude
|
|
179
|
+
dsh-coding-oauth login codex --device-auth
|
|
180
|
+
dsh-coding-oauth login codex --browser
|
|
181
|
+
dsh-coding-oauth login kimi
|
|
182
|
+
dsh-coding-oauth login claude
|
|
183
|
+
|
|
184
|
+
# 状态/登出
|
|
185
|
+
dsh-coding-oauth status all
|
|
186
|
+
dsh-coding-oauth logout kimi
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## 模型路由
|
|
190
|
+
|
|
191
|
+
- `grok-build/<model>`
|
|
192
|
+
- `codex-oauth/<model>`
|
|
193
|
+
- `codex-oauth-fast/<model>`(可选;仅在最新 live catalog 标明 `priority` 可用后出现,界面为 已请求 Fast)
|
|
194
|
+
- `kimi-code-oauth/<model>`
|
|
195
|
+
- `claude-code-oauth/<model>`
|
|
196
|
+
- `agy/<model>`(安装 dsh-agy 后)
|
|
197
|
+
|
|
198
|
+
这些别名专门避免与已有的 `xai`、`openai`、`kimi-coding` API-key routes 冲突。插件不会修改现有默认模型设置。未认证的 OAuth route 不向模型选择器返回任何模型;认证后供应商名显示为 `(OAuth)`,登录/登出会立即触发目录刷新。
|
|
199
|
+
|
|
200
|
+
## 凭据与缓存
|
|
201
|
+
|
|
202
|
+
OAuth 凭据:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
$DSH_HOME/.grok-build-auth.json
|
|
206
|
+
$DSH_HOME/.codex-oauth-auth.json
|
|
207
|
+
$DSH_HOME/.kimi-code-oauth-auth.json
|
|
208
|
+
$DSH_HOME/.claude-code-oauth-auth.json
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
均为 `0600`、原子写、文件锁保护。模型缓存为对应的 `*-models.json`,不含 token。Grok Imagine 使用 DSH 凭据引用 `XAI_API_KEY`,与上述 OAuth 文件分离;视频产物存入 `$DSH_HOME/.dsh-coding-subscription-oauth-media/`(目录 `0700`、文件 `0600`),按保留设置自动清理。
|
|
212
|
+
|
|
213
|
+
## 卸载
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
dsh plugin --profile web remove dsh-agy dsh-coding-subscription-oauth
|
|
217
|
+
rm -f ~/.dsh/.grok-build-auth.json ~/.dsh/.codex-oauth-auth.json \
|
|
218
|
+
~/.dsh/.kimi-code-oauth-auth.json ~/.dsh/.claude-code-oauth-auth.json
|
|
219
|
+
rm -f ~/.dsh/.grok-build-models.json ~/.dsh/.codex-oauth-models.json \
|
|
220
|
+
~/.dsh/.kimi-code-oauth-models.json ~/.dsh/.claude-code-oauth-models.json
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
只有在确认不再需要账号后才删除凭据文件。
|
|
224
|
+
|
|
225
|
+
## 部署验收
|
|
226
|
+
|
|
227
|
+
以下命令面向维护者,需要在源码 checkout 中运行;通过 npm 安装的用户无需执行。
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pnpm run verify:deployed
|
|
231
|
+
|
|
232
|
+
DSH_RESTORE_PROVIDER=openai \
|
|
233
|
+
DSH_RESTORE_MODEL=gpt-5.6-sol \
|
|
234
|
+
DSH_RESTORE_REASONING=max \
|
|
235
|
+
pnpm run smoke:deployed
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
第一条命令验证真实模型目录的认证门禁和 `(OAuth)` 标签。第二条会通过运行中的 DSH 分别执行 Codex/Kimi 的 tool-call 与第二个用户 turn(覆盖 `INVALID_REPLAY_STATE` 回归),随后恢复显式指定的默认模型并归档测试会话;为避免覆盖现有默认设置,不提供 `DSH_RESTORE_*` 时脚本拒绝运行。
|
|
239
|
+
|
|
240
|
+
## 故障排查
|
|
241
|
+
|
|
242
|
+
| 现象 | 处理 |
|
|
243
|
+
|---|---|
|
|
244
|
+
| 还在搜 / 装着 `dsh-grok-build` | 仓库已更名为 `dsh-coding-subscription-oauth`;旧 GitHub 仓库已删除。请改用 npm 包或 `github:lninghaha/dsh-coding-subscription-oauth` |
|
|
245
|
+
| Codex localhost callback 打不开 | 改用设备码,或把完整 redirect URL 粘贴回设置页 |
|
|
246
|
+
| Claude localhost callback 在远端浏览器 | 把完整 redirect URL 粘贴回设置页 |
|
|
247
|
+
| Kimi 401/403 | 重新登录并确认 Kimi Code 会员有效;不要改成 moonshot.cn OAuth |
|
|
248
|
+
| OAuth refresh failed | 对应账号重新登录;插件不会回退到其他账号或 API key |
|
|
249
|
+
| 模型 route 重复 | 保留本插件的 `*-oauth` alias,移除冲突的第三方 OAuth 插件 |
|
|
250
|
+
| Antigravity 页面 404 | 安全配置默认禁用了 `dsh-agy-web`;使用 CLI |
|
|
251
|
+
| Google/Claude/OpenAI 网络不可达 | 检查插件 scoped proxy;不要重启或修改系统网络服务 |
|
|
252
|
+
|
|
253
|
+
## 合规提示
|
|
254
|
+
|
|
255
|
+
订阅 OAuth 接入第三方 harness 可能违反或触及供应商服务条款。仅供个人账号使用,自行承担配额和账号风险;商用请使用官方 API-key 通道。
|
package/LICENSE
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
Copyright 2026 dsh-xai contributors
|
|
8
|
-
|
|
9
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License.
|
|
11
|
-
You may obtain a copy of the License at
|
|
12
|
-
|
|
13
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
See the License for the specific language governing permissions and
|
|
19
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
Copyright 2026 dsh-xai contributors
|
|
8
|
+
|
|
9
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
you may not use this file except in compliance with the License.
|
|
11
|
+
You may obtain a copy of the License at
|
|
12
|
+
|
|
13
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
|
|
15
|
+
Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
See the License for the specific language governing permissions and
|
|
19
|
+
limitations under the License.
|
package/NOTICE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
NOTICE
|
|
2
|
-
======
|
|
3
|
-
|
|
4
|
-
dsh-coding-subscription-oauth (formerly dsh-grok-build) — coding-subscription OAuth for DeepSeek Harness
|
|
5
|
-
Copyright 2026 lninghaha
|
|
6
|
-
|
|
7
|
-
This product includes software developed by the dsh-xai project
|
|
8
|
-
(https://github.com/MirDie/dsh-xai), licensed under the Apache License,
|
|
9
|
-
Version 2.0. Portions of src/store.ts, src/session.ts, src/grok-import.ts,
|
|
10
|
-
src/redact.ts, src/invariant.ts, src/adapter.ts, src/auth.ts, src/bin.ts and
|
|
11
|
-
the build scaffolding are derived from that work.
|
|
1
|
+
NOTICE
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
dsh-coding-subscription-oauth (formerly dsh-grok-build) — coding-subscription OAuth for DeepSeek Harness
|
|
5
|
+
Copyright 2026 lninghaha
|
|
6
|
+
|
|
7
|
+
This product includes software developed by the dsh-xai project
|
|
8
|
+
(https://github.com/MirDie/dsh-xai), licensed under the Apache License,
|
|
9
|
+
Version 2.0. Portions of src/store.ts, src/session.ts, src/grok-import.ts,
|
|
10
|
+
src/redact.ts, src/invariant.ts, src/adapter.ts, src/auth.ts, src/bin.ts and
|
|
11
|
+
the build scaffolding are derived from that work.
|